1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/7c39287ab3d0/
Changeset:   7c39287ab3d0
Branch:      copy-in-cache
User:        RonnyPfannschmidt
Date:        2015-02-19 21:05:29+00:00
Summary:     finish backward compat for looponfail
Affected #:  2 files

diff -r 8211b20606ae19bc1b71144e623c9bd5964773f2 -r 
7c39287ab3d0b487a74f38930df27de1f17ade08 _pytest/cache.py
--- a/_pytest/cache.py
+++ b/_pytest/cache.py
@@ -1,7 +1,8 @@
 import py
 import pytest
 import json
-
+import sys
+import pkg_resources
 
 class Cache:
     def __init__(self, config):
@@ -114,11 +115,11 @@
                     yield p
 
 
-import py
-import pytest
-
 
 def pytest_addoption(parser):
+    outside_looponfail = 'xdist' in sys.modules and \
+        'looponfail.py' in pkg_resources.resource_listdir('xdist', '.')
+
     group = parser.getgroup("general")
     group.addoption(
         '--lf', action='store_true', dest="lf",
@@ -136,9 +137,10 @@
     group.addoption(
         '--looponchange', action='store_true', dest='looponchange',
         help='rerun every time the workdir changes')
-    group.addoption(
-        '--looponfail', action='store_true', dest='looponfail',
-        help='rerun every time the workdir changes')
+    if not outside_looponfail:
+        group._addoption(
+            '-f', '--looponfail', action='store_true', dest='looponfail',
+            help='rerun every time the workdir changes')
     parser.addini(
         "looponchangeroots", type="pathlist",
         help="directories to check for changes", default=[py.path.local()])

diff -r 8211b20606ae19bc1b71144e623c9bd5964773f2 -r 
7c39287ab3d0b487a74f38930df27de1f17ade08 _pytest/onchange.py
--- a/_pytest/onchange.py
+++ b/_pytest/onchange.py
@@ -9,12 +9,16 @@
 
 def looponchange(config):
     newargs = config._origargs[:]
-    newargs.remove('--looponchange')
+    if '--looponchange' in newargs:
+        newargs.remove('--looponchange')
+    else:
+        newargs.remove('-f')
     stats = StatRecorder(config.getini('looponchangeroots'))
     command = py.std.functools.partial(
         py.std.subprocess.call, [
             py.std.sys.executable,
             '-c', SCRIPT % newargs])
+    command()
     loop_forever(stats, command)
     return 2

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to