[PATCH 2 of 2 V2] tests: use require() instead of hghave in .py tests

Gregory Szorc gregory.szorc at gmail.com
Fri Mar 18 21:39:36 EDT 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1458350976 25200
#      Fri Mar 18 18:29:36 2016 -0700
# Node ID d401232c4cf706edf387b00563919236a10a8d8f
# Parent  080070fdcd2672e06899daa8e162fd759609c793
tests: use require() instead of hghave in .py tests

This is much simpler, isn't it?

diff --git a/tests/test-filecache.py b/tests/test-filecache.py
--- a/tests/test-filecache.py
+++ b/tests/test-filecache.py
@@ -1,10 +1,7 @@
-import sys, os, subprocess
+require(['cacheable'])
 
-if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'],
-                    'cacheable']):
-    sys.exit(80)
-
+import os
 from mercurial import util, scmutil, extensions, hg, ui
 
 filecache = scmutil.filecache
 
diff --git a/tests/test-verify-repo-operations.py b/tests/test-verify-repo-operations.py
--- a/tests/test-verify-repo-operations.py
+++ b/tests/test-verify-repo-operations.py
@@ -1,21 +1,17 @@
 from __future__ import print_function, absolute_import
 
+require(['slow'])
+
 """Fuzz testing for operations against a Mercurial repository
 
 This uses Hypothesis's stateful testing to generate random repository
 operations and test Mercurial using them, both to see if there are any
 unexpected errors and to compare different versions of it."""
 
 import os
-import subprocess
 import sys
 
-# Only run if slow tests are allowed
-if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'],
-                    'slow']):
-    sys.exit(80)
-
 # These tests require Hypothesis and pytz to be installed.
 # Running 'pip install hypothesis pytz' will achieve that.
 # Note: This won't work if you're running Python < 2.7.
 try:


More information about the Mercurial-devel mailing list