From c338aee30a2f493811c81e8ea91c6f6ed33a59c3 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Thu, 2 Jun 2016 15:39:07 -0400 Subject: [PATCH] test imports: added a function for nosetests --- gramps/plugins/test/test_imports.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gramps/plugins/test/test_imports.py b/gramps/plugins/test/test_imports.py index 1d51ea5c1..02f81b44b 100644 --- a/gramps/plugins/test/test_imports.py +++ b/gramps/plugins/test/test_imports.py @@ -240,6 +240,7 @@ if _tstfile: # single file mode (CompleteCheck,), {"testit": test_func}) else: + _tstfiles = [] for _tstfile in os.listdir(TEST_DIR): (fname, ext) = os.path.splitext(os.path.basename(_tstfile)) if ext == ".gramps" or ext == ".difs" or ext == ".bak": @@ -249,7 +250,18 @@ else: globals()[clname] = type(clname, (CompleteCheck,), {"testit": test_func}) + _tstfiles.append(clname) + def test_import_classes(): + """ + Dynamic Test-function lister for + nosetests. Creates an instance for each + import test, and yields the function to + test. + """ + for clname in _tstfiles: + instance = globals()[clname]() + yield instance.testit if __name__ == "__main__": unittest.main()