Mercurial > hg
diff tests/test-demandimport.py @ 49972:1bd33932713d
branching: merge with stable
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 31 Jan 2023 11:41:59 +0100 |
parents | ecde742a5a9d 32155ea1e930 |
children | d718eddf01d9 |
line wrap: on
line diff
--- a/tests/test-demandimport.py Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-demandimport.py Tue Jan 31 11:41:59 2023 +0100 @@ -8,6 +8,7 @@ import types # Don't import pycompat because it has too many side-effects. +ispy311 = (sys.version_info.major, sys.version_info.minor) >= (3, 11) # Only run if demandimport is allowed if subprocess.call( @@ -73,8 +74,7 @@ assert 'mercurial.error' not in sys.modules from mercurial import error as errorproxy -# unsure why this isn't lazy. -assert not isinstance(f, _LazyModule) +assert isinstance(errorproxy, _LazyModule) assert f(errorproxy) == "<module 'mercurial.error' from '?'>", f(errorproxy) doc = ' '.join(errorproxy.__doc__.split()[:3]) @@ -92,10 +92,16 @@ import os 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) 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