changes for MODE=tiny

unittest checks if a directory is a package by looking for an
__init__.py inside. In MODE=tiny we only have a .pyc file.
This commit is contained in:
ahgamut 2022-05-13 22:14:45 +05:30
parent 09d9129f16
commit 97d18c2cdc
3 changed files with 6 additions and 2 deletions

View file

@ -200,6 +200,7 @@ class SysModuleTest(unittest.TestCase):
self.assertEqual(sys.getrecursionlimit(), 10000) self.assertEqual(sys.getrecursionlimit(), 10000)
sys.setrecursionlimit(oldlimit) sys.setrecursionlimit(oldlimit)
@unittest.skipIf("tiny" in cosmo.MODE, "")
def test_recursionlimit_recovery(self): def test_recursionlimit_recovery(self):
if hasattr(sys, 'gettrace') and sys.gettrace(): if hasattr(sys, 'gettrace') and sys.gettrace():
self.skipTest('fatal error if run with a trace function') self.skipTest('fatal error if run with a trace function')
@ -259,6 +260,7 @@ class SysModuleTest(unittest.TestCase):
finally: finally:
sys.setrecursionlimit(oldlimit) sys.setrecursionlimit(oldlimit)
@unittest.skipIf("tiny" in cosmo.MODE, "")
def test_recursionlimit_fatalerror(self): def test_recursionlimit_fatalerror(self):
# A fatal error occurs if a second recursion limit is hit when recovering # A fatal error occurs if a second recursion limit is hit when recovering
# from a first one. # from a first one.

View file

@ -474,7 +474,7 @@ class TestMkstempInner(TestBadTempdir, BaseTestCase):
# effect. The core of this test is therefore in # effect. The core of this test is therefore in
# tf_inherit_check.py, which see. # tf_inherit_check.py, which see.
tester = os.path.join(os.path.dirname(os.path.abspath(me)), tester = os.path.join(os.path.dirname(os.path.abspath(me)),
"tf_inherit_check.py") "tf_inherit_check.pyc")
# On Windows a spawn* /path/ with embedded spaces shouldn't be quoted, # On Windows a spawn* /path/ with embedded spaces shouldn't be quoted,
# but an arg with embedded spaces should be decorated with double # but an arg with embedded spaces should be decorated with double

View file

@ -283,7 +283,9 @@ class TestLoader(object):
if os.path.isdir(os.path.abspath(start_dir)): if os.path.isdir(os.path.abspath(start_dir)):
start_dir = os.path.abspath(start_dir) start_dir = os.path.abspath(start_dir)
if start_dir != top_level_dir: if start_dir != top_level_dir:
is_not_importable = not os.path.isfile(os.path.join(start_dir, '__init__.py')) is_not_importable_py = not os.path.isfile(os.path.join(start_dir, '__init__.py'))
is_not_importable_pyc = not os.path.isfile(os.path.join(start_dir, '__init__.pyc'))
is_not_importable = is_not_importable_py and is_not_importable_pyc
else: else:
# support for discovery from dotted module names # support for discovery from dotted module names
try: try: