diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-11-09 14:42:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 14:42:34 (GMT) |
commit | 0c42f7304a2757fe0f78bc6c6fbb33225cd9da15 (patch) | |
tree | 2af6b99898f510a42fd92785b8b34be7adbfe3c4 /Lib/test/test_module | |
parent | 0372e3b02a7e3dc1c564dba94dcd817c5472b04f (diff) | |
download | cpython-0c42f7304a2757fe0f78bc6c6fbb33225cd9da15.zip cpython-0c42f7304a2757fe0f78bc6c6fbb33225cd9da15.tar.gz cpython-0c42f7304a2757fe0f78bc6c6fbb33225cd9da15.tar.bz2 |
gh-108303: Move more files to `Lib/test/test_module` (#111880)
Diffstat (limited to 'Lib/test/test_module')
-rw-r--r-- | Lib/test/test_module/__init__.py | 2 | ||||
-rw-r--r-- | Lib/test/test_module/final_a.py | 19 | ||||
-rw-r--r-- | Lib/test/test_module/final_b.py | 19 |
3 files changed, 39 insertions, 1 deletions
diff --git a/Lib/test/test_module/__init__.py b/Lib/test/test_module/__init__.py index 2524e6c..db2133a 100644 --- a/Lib/test/test_module/__init__.py +++ b/Lib/test/test_module/__init__.py @@ -266,7 +266,7 @@ a = A(destroyed)""" def test_module_finalization_at_shutdown(self): # Module globals and builtins should still be available during shutdown - rc, out, err = assert_python_ok("-c", "from test import final_a") + rc, out, err = assert_python_ok("-c", "from test.test_module import final_a") self.assertFalse(err) lines = out.splitlines() self.assertEqual(set(lines), { diff --git a/Lib/test/test_module/final_a.py b/Lib/test/test_module/final_a.py new file mode 100644 index 0000000..a983f31 --- /dev/null +++ b/Lib/test/test_module/final_a.py @@ -0,0 +1,19 @@ +""" +Fodder for module finalization tests in test_module. +""" + +import shutil +import test.test_module.final_b + +x = 'a' + +class C: + def __del__(self): + # Inspect module globals and builtins + print("x =", x) + print("final_b.x =", test.test_module.final_b.x) + print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None)) + print("len =", getattr(len, '__name__', None)) + +c = C() +_underscored = C() diff --git a/Lib/test/test_module/final_b.py b/Lib/test/test_module/final_b.py new file mode 100644 index 0000000..f3e8d55 --- /dev/null +++ b/Lib/test/test_module/final_b.py @@ -0,0 +1,19 @@ +""" +Fodder for module finalization tests in test_module. +""" + +import shutil +import test.test_module.final_a + +x = 'b' + +class C: + def __del__(self): + # Inspect module globals and builtins + print("x =", x) + print("final_a.x =", test.test_module.final_a.x) + print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None)) + print("len =", getattr(len, '__name__', None)) + +c = C() +_underscored = C() |