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

login
register
mail settings
Submitter Gregory Szorc
Date March 19, 2016, 1:39 a.m.
Message ID <d401232c4cf706edf387.1458351576@gps-mbp.local>
Download mbox | patch
Permalink /patch/13947/
State Accepted
Headers show

Comments

Gregory Szorc - March 19, 2016, 1:39 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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?

Patch

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: