# HG changeset patch # User Martin von Zweigbergk # Date 1518809418 28800 # Node ID b39f0fdb0338a443e4e4eb1d502e4d0c37060c87 # Parent 564dec70b50c5a7fd76aa8b49ef7e8ccf941d377 tests: actually check that HGDEMANDIMPORT=disable disables demandimport At the point in the test where we were checking that the 'node' got eagerly loaded, it had already been loaded (via the pvec module), so our check wasn't doing anything (i.e. the test would pass even if you removed the line that set HGDEMANDIMPORT=disable). Let's move this test earlier so it tests what it was meant to test. Differential Revision: https://phab.mercurial-scm.org/D2286 diff -r 564dec70b50c -r b39f0fdb0338 tests/test-demandimport.py --- a/tests/test-demandimport.py Thu Jan 04 16:29:07 2018 -0800 +++ b/tests/test-demandimport.py Fri Feb 16 11:30:18 2018 -0800 @@ -31,6 +31,16 @@ l = rsub("'<[a-z]*>'", "''", l) return l +demandimport.disable() +os.environ['HGDEMANDIMPORT'] = 'disable' +# this enable call should not actually enable demandimport! +demandimport.enable() +from mercurial import node +print("node =", f(node)) +# now enable it for real +del os.environ['HGDEMANDIMPORT'] +demandimport.enable() + import os print("os =", f(os)) @@ -97,10 +107,3 @@ print("__import__('contextlib', ..., ['unknownattr']) =", f(contextlibimp)) print("hasattr(contextlibimp, 'unknownattr') =", util.safehasattr(contextlibimp, 'unknownattr')) - -demandimport.disable() -os.environ['HGDEMANDIMPORT'] = 'disable' -# this enable call should not actually enable demandimport! -demandimport.enable() -from mercurial import node -print("node =", f(node)) diff -r 564dec70b50c -r b39f0fdb0338 tests/test-demandimport.py.out --- a/tests/test-demandimport.py.out Thu Jan 04 16:29:07 2018 -0800 +++ b/tests/test-demandimport.py.out Fri Feb 16 11:30:18 2018 -0800 @@ -1,3 +1,4 @@ +node = os = os.system = os = @@ -27,4 +28,3 @@ contextlib.unknownattr = ImportError: cannot import name unknownattr __import__('contextlib', ..., ['unknownattr']) = hasattr(contextlibimp, 'unknownattr') = False -node =