Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3.5 Changeset: r88420:e6b9354a3e71 Date: 2016-11-17 01:32 +0000 http://bitbucket.org/pypy/pypy/changeset/e6b9354a3e71/
Log: Also test directories inside lib-python/3/test, not just plain files diff --git a/lib-python/3/test/test_importlib/__main__.py b/lib-python/3/test/test_importlib/__main__.py --- a/lib-python/3/test/test_importlib/__main__.py +++ b/lib-python/3/test/test_importlib/__main__.py @@ -1,4 +1,5 @@ from . import load_tests +print('loaded tests') import unittest unittest.main() diff --git a/lib-python/3/unittest/main.py b/lib-python/3/unittest/main.py --- a/lib-python/3/unittest/main.py +++ b/lib-python/3/unittest/main.py @@ -59,6 +59,7 @@ testRunner=None, testLoader=loader.defaultTestLoader, exit=True, verbosity=1, failfast=None, catchbreak=None, buffer=None, warnings=None, *, tb_locals=False): + print('TestProgram()') if isinstance(module, str): self.module = __import__(module) for part in module.split('.')[1:]: @@ -74,6 +75,7 @@ self.verbosity = verbosity self.buffer = buffer self.tb_locals = tb_locals + print('1') if warnings is None and not sys.warnoptions: # even if DeprecationWarnings are ignored by default # print them anyway unless other warnings settings are @@ -90,7 +92,9 @@ self.testRunner = testRunner self.testLoader = testLoader self.progName = os.path.basename(argv[0]) + print('parsing') self.parseArgs(argv) + print('running') self.runTests() def usageExit(self, msg=None): @@ -111,6 +115,7 @@ print(MODULE_EXAMPLES % {'prog': self.progName}) def parseArgs(self, argv): + print('in parseArgs()') self._initArgParsers() if self.module is None: if len(argv) > 1 and argv[1].lower() == 'discover': @@ -137,12 +142,15 @@ self.testNames = (self.defaultTest,) else: self.testNames = list(self.defaultTest) + print('creating tests') self.createTests() def createTests(self): if self.testNames is None: + print('loading from module', self.module) self.test = self.testLoader.loadTestsFromModule(self.module) else: + print('loading', self.testNames, 'from', self.module) self.test = self.testLoader.loadTestsFromNames(self.testNames, self.module) @@ -228,6 +236,7 @@ self.test = loader.discover(self.start, self.pattern, self.top) def runTests(self): + print('in runTests()') if self.catchbreak: installHandler() if self.testRunner is None: diff --git a/lib-python/conftest.py b/lib-python/conftest.py --- a/lib-python/conftest.py +++ b/lib-python/conftest.py @@ -110,6 +110,7 @@ RegrTest('test_asdl_parser.py'), RegrTest('test_ast.py', core=True, usemodules='struct'), RegrTest('test_asynchat.py', usemodules='select fcntl'), + RegrTest('test_asyncio'), RegrTest('test_asyncore.py', usemodules='select fcntl'), RegrTest('test_atexit.py', core=True), RegrTest('test_audioop.py'), @@ -199,7 +200,7 @@ RegrTest('test_dynamic.py'), RegrTest('test_dynamicclassattribute.py'), RegrTest('test_eintr.py'), - RegrTest('test_email', skip="XXX is a directory"), + RegrTest('test_email'), RegrTest('test_ensurepip.py'), RegrTest('test_enum.py'), RegrTest('test_enumerate.py', core=True), @@ -258,8 +259,9 @@ RegrTest('test_idle.py'), RegrTest('test_imaplib.py'), RegrTest('test_imghdr.py'), + RegrTest('test_import'), + RegrTest('test_importlib', skip='XXX segfaults'), RegrTest('test_imp.py', core=True, usemodules='thread'), - RegrTest('test_importlib', 'XXX is a directory'), RegrTest('test_index.py'), RegrTest('test_inspect.py', usemodules="struct unicodedata"), RegrTest('test_int.py', core=True), @@ -271,7 +273,7 @@ RegrTest('test_iter.py', core=True), RegrTest('test_iterlen.py', core=True, usemodules="_collections itertools"), RegrTest('test_itertools.py', core=True, usemodules="itertools struct"), - RegrTest('test_json', skip="XXX is a directory"), + RegrTest('test_json'), RegrTest('test_keyword.py'), RegrTest('test_keywordonlyarg.py'), RegrTest('test_kqueue.py'), @@ -437,9 +439,10 @@ RegrTest('test_tix.py'), RegrTest('test_tk.py'), RegrTest('test_tokenize.py'), - RegrTest('test_trace.py'), + RegrTest('test_tools', skip="CPython internal details"), RegrTest('test_traceback.py', core=True), RegrTest('test_tracemalloc.py'), + RegrTest('test_trace.py'), RegrTest('test_ttk_guionly.py'), RegrTest('test_ttk_textonly.py'), RegrTest('test_tuple.py', core=True), @@ -470,6 +473,7 @@ RegrTest('test_venv.py', usemodules="struct"), RegrTest('test_wait3.py', usemodules="thread"), RegrTest('test_wait4.py', usemodules="thread"), + RegrTest('test_warnings'), RegrTest('test_wave.py'), RegrTest('test_weakref.py', core=True, usemodules='_weakref'), RegrTest('test_weakset.py'), @@ -513,11 +517,23 @@ cache[x.basename] = x def pytest_ignore_collect(path, config): + if path.basename == '__init__.py': + return False if path.isfile(): regrtest = config._basename2spec.get(path.basename, None) if regrtest is None or path.dirpath() != testdir: return True +def pytest_collect_file(path, parent): + if path.basename == '__init__.py': + # handle the RegrTest for the whole subpackage here + pkg_path = path.dirpath() + regrtest = parent.config._basename2spec.get(pkg_path.basename, None) + if pkg_path.dirpath() == testdir and regrtest: + return RunFileExternal( + pkg_path.basename, parent=parent, regrtest=regrtest) + + @pytest.hookimpl(tryfirst=True) def pytest_pycollect_makemodule(path, parent): config = parent.config _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit