diff options
Diffstat (limited to 'tests/test_doctests.py')
-rw-r--r-- | tests/test_doctests.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/test_doctests.py b/tests/test_doctests.py index efea589..b243ea3 100644 --- a/tests/test_doctests.py +++ b/tests/test_doctests.py @@ -1,8 +1,11 @@ -import six import doctest -from paste.util.import_string import simple_import import os +import pytest +import six + +from paste.util.import_string import simple_import + filenames = [ 'tests/template.txt', ] @@ -30,29 +33,26 @@ options = doctest.ELLIPSIS | doctest.REPORT_ONLY_FIRST_FAILURE if six.PY3: options |= doctest.IGNORE_EXCEPTION_DETAIL -def test_doctests(): - for filename in filenames: - filename = os.path.join( - os.path.dirname(os.path.dirname(__file__)), - filename) - yield do_doctest, filename -def do_doctest(filename): +@pytest.mark.parametrize('filename', filenames) +def test_doctests(filename): + filename = os.path.join( + os.path.dirname(os.path.dirname(__file__)), + filename) failure, total = doctest.testfile( filename, module_relative=False, optionflags=options) assert not failure, "Failure in %r" % filename -def test_doctest_mods(): - for module in modules: - yield do_doctest_mod, module -def do_doctest_mod(module): +@pytest.mark.parametrize('module', modules) +def test_doctest_mods(module): module = simple_import(module) failure, total = doctest.testmod( module, optionflags=options) assert not failure, "Failure in %r" % module + if __name__ == '__main__': import sys import doctest |