changeset 49941:643312047e44 stable

tests: os module is frozen in Python 3.11 (issue6786)
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 10 Jan 2023 17:23:13 +0400
parents f3e95e5a5895
children 32155ea1e930
files tests/test-demandimport.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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