tests: os module is frozen in Python 3.11 (issue6786) stable
authorAnton Shestakov <av6@dwimlabs.net>
Tue, 10 Jan 2023 17:23:13 +0400
branchstable
changeset 49941 643312047e44
parent 49902 f3e95e5a5895
child 49942 32155ea1e930
tests: os module is frozen in Python 3.11 (issue6786)
tests/test-demandimport.py
--- a/tests/test-demandimport.py	Fri Jan 13 17:33:03 2023 +0400
+++ b/tests/test-demandimport.py	Tue Jan 10 17:23:13 2023 +0400
@@ -9,6 +9,7 @@
 
 # Don't import pycompat because it has too many side-effects.
 ispy3 = sys.version_info[0] >= 3
+ispy311 = (sys.version_info.major, sys.version_info.minor) >= (3, 11)
 
 # Only run if demandimport is allowed
 if subprocess.call(
@@ -106,12 +107,18 @@
 
 if ispy3:
     assert not isinstance(os, _LazyModule)
-    assert f(os) == "<module 'os' from '?'>", f(os)
+    if ispy311:
+        assert f(os) == "<module 'os' (frozen)>", f(os)
+    else:
+        assert f(os) == "<module 'os' from '?'>", f(os)
 else:
     assert f(os) == "<unloaded module 'os'>", f(os)
 
 assert f(os.system) == '<built-in function system>', f(os.system)
-assert f(os) == "<module 'os' from '?'>", f(os)
+if ispy311:
+    assert f(os) == "<module 'os' (frozen)>", f(os)
+else:
+    assert f(os) == "<module 'os' from '?'>", f(os)
 
 assert 'mercurial.utils.procutil' not in sys.modules
 from mercurial.utils import procutil