Fix doctest
This commit is contained in:
parent
d6d9defc24
commit
ab65d8db7e
|
@ -10,7 +10,6 @@ pipeline:
|
||||||
- TOX_TESTENV_PASSENV=CFLAGS
|
- TOX_TESTENV_PASSENV=CFLAGS
|
||||||
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
|
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
|
||||||
commands:
|
commands:
|
||||||
- python tests/netrc2hgrc.py
|
|
||||||
- pip install tox
|
- pip install tox
|
||||||
- tox -e "${TOXENV}-${DATABASE}"
|
- tox -e "${TOXENV}-${DATABASE}"
|
||||||
volumes:
|
volumes:
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -138,4 +138,7 @@ setup(name=name,
|
||||||
test_loader='trytond.test_loader:Loader',
|
test_loader='trytond.test_loader:Loader',
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
use_2to3=True,
|
use_2to3=True,
|
||||||
|
convert_2to3_doctests=[
|
||||||
|
'tests/scenario_load.rst',
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
import netrc
|
|
||||||
import os
|
|
||||||
try:
|
|
||||||
from configparser import ConfigParser, DuplicateSectionError
|
|
||||||
except ImportError:
|
|
||||||
from ConfigParser import ConfigParser, DuplicateSectionError
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
netrc_ = netrc.netrc(os.path.expanduser('~/.netrc'))
|
|
||||||
config = ConfigParser()
|
|
||||||
try:
|
|
||||||
config.add_section('auth')
|
|
||||||
except DuplicateSectionError:
|
|
||||||
pass
|
|
||||||
hgrc = os.path.expanduser('~/.hgrc')
|
|
||||||
config.read(hgrc)
|
|
||||||
for host, (login, _, password) in netrc_.hosts.items():
|
|
||||||
config.set('auth', host + '.prefix', host)
|
|
||||||
config.set('auth', host + '.username', login)
|
|
||||||
config.set('auth', host + '.password', password)
|
|
||||||
with open(hgrc, 'w') as fp:
|
|
||||||
config.write(fp)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -16,14 +16,9 @@ Imports::
|
||||||
>>> from.trytond.modules.account_invoice.tests.tools import \
|
>>> from.trytond.modules.account_invoice.tests.tools import \
|
||||||
... set_fiscalyear_invoice_sequences, create_payment_term
|
... set_fiscalyear_invoice_sequences, create_payment_term
|
||||||
>>> from trytond.modules.stock_unit_load.tests.tools import create_unit_load
|
>>> from trytond.modules.stock_unit_load.tests.tools import create_unit_load
|
||||||
>>> from proteus import config, Model, Wizard
|
>>> from proteus import Model, Wizard
|
||||||
>>> today = datetime.date.today()
|
>>> today = datetime.date.today()
|
||||||
|
|
||||||
Create database::
|
|
||||||
|
|
||||||
>>> config = config.set_trytond()
|
|
||||||
>>> config.pool.test = True
|
|
||||||
|
|
||||||
Install agro Module::
|
Install agro Module::
|
||||||
|
|
||||||
>>> config = activate_modules('carrier_load_done2running')
|
>>> config = activate_modules('carrier_load_done2running')
|
||||||
|
|
|
@ -4,22 +4,20 @@ import unittest
|
||||||
import doctest
|
import doctest
|
||||||
import trytond.tests.test_tryton
|
import trytond.tests.test_tryton
|
||||||
from trytond.tests.test_tryton import ModuleTestCase
|
from trytond.tests.test_tryton import ModuleTestCase
|
||||||
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
|
from trytond.tests.test_tryton import doctest_teardown, doctest_checker
|
||||||
|
|
||||||
|
|
||||||
class TestCase(ModuleTestCase):
|
class TestCase(ModuleTestCase):
|
||||||
"""Test module"""
|
"""Test module"""
|
||||||
module = 'carrier_load_done2running'
|
module = 'carrier_load_done2running'
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestCase, self).setUp()
|
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = trytond.tests.test_tryton.suite()
|
suite = trytond.tests.test_tryton.suite()
|
||||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestCase))
|
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestCase))
|
||||||
suite.addTests(doctest.DocFileSuite(
|
suite.addTests(doctest.DocFileSuite(
|
||||||
'scenario_load.rst',
|
'scenario_load.rst',
|
||||||
setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
|
tearDown=doctest_teardown, encoding='utf-8',
|
||||||
|
checker=doctest_checker,
|
||||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||||
return suite
|
return suite
|
||||||
|
|
Loading…
Reference in New Issue