Fix doctest
This commit is contained in:
parent
85fca8ab2f
commit
e087963ed4
|
@ -10,7 +10,6 @@ pipeline:
|
|||
- TOX_TESTENV_PASSENV=CFLAGS
|
||||
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
|
||||
commands:
|
||||
- python tests/netrc2hgrc.py
|
||||
- pip install tox
|
||||
- tox -e "${TOXENV}-${DATABASE}"
|
||||
volumes:
|
||||
|
|
3
setup.py
3
setup.py
|
@ -131,4 +131,7 @@ setup(name=name,
|
|||
test_loader='trytond.test_loader:Loader',
|
||||
tests_require=tests_require,
|
||||
use_2to3=True,
|
||||
convert_2to3_doctests=[
|
||||
'tests/scenario_sale.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()
|
|
@ -9,7 +9,7 @@ Imports::
|
|||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import config, Model, Wizard, Report
|
||||
>>> from proteus import Model, Wizard, Report
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
|
@ -18,11 +18,6 @@ Imports::
|
|||
... set_fiscalyear_invoice_sequences, create_payment_term
|
||||
>>> today = datetime.date.today()
|
||||
|
||||
Create database::
|
||||
|
||||
>>> config = config.set_trytond()
|
||||
>>> config.pool.test = True
|
||||
|
||||
Install sale::
|
||||
|
||||
>>> config = activate_modules('sale_unit_load')
|
||||
|
|
|
@ -4,22 +4,21 @@ import unittest
|
|||
import doctest
|
||||
import trytond.tests.test_tryton
|
||||
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 SaleUnitLoadTestCase(ModuleTestCase):
|
||||
"""Test Sale unit load module"""
|
||||
module = 'sale_unit_load'
|
||||
|
||||
def setUp(self):
|
||||
super(SaleUnitLoadTestCase, self).setUp()
|
||||
|
||||
|
||||
def suite():
|
||||
suite = trytond.tests.test_tryton.suite()
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SaleUnitLoadTestCase))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
||||
SaleUnitLoadTestCase))
|
||||
suite.addTests(doctest.DocFileSuite(
|
||||
'scenario_sale.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))
|
||||
return suite
|
||||
|
|
Loading…
Reference in New Issue