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

Augie Fackler raf at durin42.com
Thu Apr 7 15:17:08 UTC 2016


> On Mar 18, 2016, at 21:39, Gregory Szorc <gregory.szorc at gmail.com> wrote:
> 
> # 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?

I'm getting some failures with this (though I want it to work very much):

--- /home/augie/hg/tests/test-verify-repo-operations.py.out
+++ /home/augie/hg/tests/test-verify-repo-operations.py.err
@@ -0,0 +1,4 @@
+Traceback (most recent call last):
+  File "/home/augie/hg/tests/test-verify-repo-operations.py", line 3, in <module>
+    require(['slow'])
+NameError: name 'require' is not defined

ERROR: test-verify-repo-operations.py output changed


(plus one other failure in test-filecache, but you get the idea)

> 
> 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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list