changeset 45249:357d8415aa27

tests: virtualenv is only used on py2, rename and conditionalize If I have I have the Debian `python3-virtualenv` package installed on my machine, the import succeeds but then I receive an AttributeError because the package is essentially completely different between py2 and py3, and test-hghave fails. Differential Revision: https://phab.mercurial-scm.org/D8812
author Kyle Lippincott <spectral@google.com>
date Fri, 24 Jul 2020 12:13:10 -0700
parents a253ded5b03d
children 4e5da64d5549
files tests/hghave.py tests/test-install.t
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Thu Jul 23 13:31:45 2020 -0700
+++ b/tests/hghave.py	Fri Jul 24 12:13:10 2020 -0700
@@ -886,8 +886,11 @@
         return False
 
 
-@check("virtualenv", "Python virtualenv support")
-def has_virtualenv():
+@check("py2virtualenv", "Python2 virtualenv support")
+def has_py2virtualenv():
+    if sys.version_info[0] != 2:
+        return False
+
     try:
         import virtualenv
 
--- a/tests/test-install.t	Thu Jul 23 13:31:45 2020 -0700
+++ b/tests/test-install.t	Fri Jul 24 12:13:10 2020 -0700
@@ -214,7 +214,7 @@
   no problems detected
 #endif
 
-#if no-py3 virtualenv
+#if py2virtualenv
 
 Note: --no-site-packages is deprecated, but some places have an
 ancient virtualenv from their linux distro or similar and it's not yet