D2286: tests: actually check that HGDEMANDIMPORT=disable disables demandimport

2018-02-16 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG02bb24cf6fd9: tests: actually check that 
HGDEMANDIMPORT=disable disables demandimport (authored by martinvonz, committed 
by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2286?vs=5779&id=5787

REVISION DETAIL
  https://phab.mercurial-scm.org/D2286

AFFECTED FILES
  tests/test-demandimport.py
  tests/test-demandimport.py.out

CHANGE DETAILS

diff --git a/tests/test-demandimport.py.out b/tests/test-demandimport.py.out
--- a/tests/test-demandimport.py.out
+++ b/tests/test-demandimport.py.out
@@ -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 = 
diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
--- a/tests/test-demandimport.py
+++ b/tests/test-demandimport.py
@@ -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))



To: martinvonz, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2286: tests: actually check that HGDEMANDIMPORT=disable disables demandimport

2018-02-16 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2286

AFFECTED FILES
  tests/test-demandimport.py
  tests/test-demandimport.py.out

CHANGE DETAILS

diff --git a/tests/test-demandimport.py.out b/tests/test-demandimport.py.out
--- a/tests/test-demandimport.py.out
+++ b/tests/test-demandimport.py.out
@@ -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 = 
diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
--- a/tests/test-demandimport.py
+++ b/tests/test-demandimport.py
@@ -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))



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel