Skip to content
Snippets Groups Projects
Commit c51e7ffd5abe authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Test README with unittest discover

parent 3323e3e26d8a
No related branches found
No related tags found
1 merge request!6Test README with unittest discover
Pipeline #75709 passed
#!/usr/bin/env python
# This file is part of mt940. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""Test MT940
"""
import datetime
......@@ -2,8 +1,7 @@
# This file is part of mt940. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""Test MT940
"""
import datetime
import doctest
import io
import os
......@@ -8,6 +6,5 @@
import io
import os
import sys
import unittest
from decimal import Decimal
......@@ -16,7 +13,6 @@
regiobank_description)
here = os.path.dirname(__file__)
readme = os.path.normpath(os.path.join(here, '..', 'README'))
class TestMT940(unittest.TestCase):
......@@ -234,29 +230,3 @@
bar
test"""
self.assertEqual(regiobank_description(description), {})
def test_suite():
suite = additional_tests()
loader = unittest.TestLoader()
suite.addTests(loader.loadTestsFromTestCase(TestMT940))
return suite
def additional_tests():
suite = unittest.TestSuite()
if os.path.isfile(readme):
suite.addTest(doctest.DocFileSuite(readme, module_relative=False))
return suite
def main():
suite = test_suite()
runner = unittest.TextTestRunner()
return runner.run(suite)
if __name__ == '__main__':
sys.path.insert(0, os.path.dirname(os.path.dirname(
os.path.dirname(os.path.abspath(__file__)))))
sys.exit(not main().wasSuccessful())
# This file is part of mt940. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import doctest
import os
here = os.path.dirname(__file__)
readme = os.path.normpath(os.path.join(here, '..', 'README.rst'))
def load_tests(loader, tests, pattern):
if os.path.isfile(readme):
tests.addTest(doctest.DocFileSuite(
readme, module_relative=False,
encoding='utf-8',
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return tests
......@@ -55,5 +55,4 @@
'Topic :: Utilities',
],
license='BSD',
test_suite='mt940.test',
)
......@@ -11,8 +11,8 @@
commands =
coverage run --omit=*/tests/* -m xmlrunner discover -s mt940.test {posargs}
commands_post =
coverage report --omit=README
coverage xml --omit=README
coverage report --omit=README.rst
coverage xml --omit=README.rst
deps =
coverage
unittest-xml-reporting
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment