diff --git a/tests/hghave.py b/tests/hghave.py
index a253ded5b03dcc083d8538c7e743e9ef44610bcc_dGVzdHMvaGdoYXZlLnB5..357d8415aa27b5366799adbb93896f0c592dffe8_dGVzdHMvaGdoYXZlLnB5 100644
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -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
 
diff --git a/tests/test-install.t b/tests/test-install.t
index a253ded5b03dcc083d8538c7e743e9ef44610bcc_dGVzdHMvdGVzdC1pbnN0YWxsLnQ=..357d8415aa27b5366799adbb93896f0c592dffe8_dGVzdHMvdGVzdC1pbnN0YWxsLnQ= 100644
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -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