tests: os module is frozen in Python 3.11 (
issue6786)
--- 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