fix various flakes issues and add "flakes" to tox tests
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import pytest
|
||||
import py
|
||||
import sys
|
||||
|
||||
class TestDistribution:
|
||||
def test_n1_pass(self, testdir):
|
||||
@@ -194,7 +192,7 @@ class TestDistribution:
|
||||
assert dest.join(subdir.basename).check(dir=1)
|
||||
|
||||
def test_data_exchange(self, testdir):
|
||||
c1 = testdir.makeconftest("""
|
||||
testdir.makeconftest("""
|
||||
# This hook only called on master.
|
||||
def pytest_configure_node(node):
|
||||
node.slaveinput['a'] = 42
|
||||
@@ -251,7 +249,7 @@ class TestDistribution:
|
||||
|
||||
def test_keyboard_interrupt_dist(self, testdir):
|
||||
# xxx could be refined to check for return code
|
||||
p = testdir.makepyfile("""
|
||||
testdir.makepyfile("""
|
||||
def test_sleep():
|
||||
import time
|
||||
time.sleep(10)
|
||||
@@ -301,7 +299,7 @@ class TestDistEach:
|
||||
|
||||
class TestTerminalReporting:
|
||||
def test_pass_skip_fail(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
testdir.makepyfile("""
|
||||
import py
|
||||
def test_ok():
|
||||
pass
|
||||
@@ -323,7 +321,7 @@ class TestTerminalReporting:
|
||||
])
|
||||
|
||||
def test_fail_platinfo(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
testdir.makepyfile("""
|
||||
def test_func():
|
||||
assert 0
|
||||
""")
|
||||
|
||||
@@ -7,14 +7,11 @@ pytest_plugins = "pytester"
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption('--gx',
|
||||
action="append", dest="gspecs",
|
||||
action="append", dest="gspecs",
|
||||
help=("add a global test environment, XSpec-syntax. "))
|
||||
|
||||
def pytest_funcarg__specssh(request):
|
||||
return getspecssh(request.config)
|
||||
def getgspecs(config):
|
||||
return [execnet.XSpec(spec)
|
||||
for spec in config.getvalueorskip("gspecs")]
|
||||
|
||||
# configuration information for tests
|
||||
def getgspecs(config):
|
||||
|
||||
@@ -4,7 +4,6 @@ from xdist.dsession import (
|
||||
EachScheduling,
|
||||
report_collection_diff,
|
||||
)
|
||||
from _pytest import main as outcome
|
||||
import py
|
||||
import pytest
|
||||
import execnet
|
||||
|
||||
@@ -42,7 +42,7 @@ class TestStatRecorder:
|
||||
|
||||
def test_dirchange(self, tmpdir):
|
||||
tmp = tmpdir
|
||||
hello = tmp.ensure("dir", "hello.py")
|
||||
tmp.ensure("dir", "hello.py")
|
||||
sd = StatRecorder([tmp])
|
||||
assert not sd.fil(tmp.join("dir"))
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ from xdist.slavemanage import SlaveController, unserialize_report
|
||||
from xdist.remote import serialize_report
|
||||
import execnet
|
||||
queue = py.builtin._tryimport("queue", "Queue")
|
||||
from py.builtin import print_
|
||||
import marshal
|
||||
|
||||
WAIT_TIMEOUT = 10.0
|
||||
@@ -26,7 +25,7 @@ class SlaveSetup:
|
||||
use_callback = False
|
||||
|
||||
def __init__(self, request):
|
||||
self.testdir = testdir = request.getfuncargvalue("testdir")
|
||||
self.testdir = request.getfuncargvalue("testdir")
|
||||
self.request = request
|
||||
self.events = queue.Queue()
|
||||
|
||||
@@ -140,7 +139,7 @@ class TestReportSerialization:
|
||||
|
||||
class TestSlaveInteractor:
|
||||
def test_basic_collect_and_runtests(self, slave):
|
||||
p = slave.testdir.makepyfile("""
|
||||
slave.testdir.makepyfile("""
|
||||
def test_func():
|
||||
pass
|
||||
""")
|
||||
@@ -170,7 +169,7 @@ class TestSlaveInteractor:
|
||||
assert 'slaveoutput' in ev.kwargs
|
||||
|
||||
def test_remote_collect_skip(self, slave):
|
||||
p = slave.testdir.makepyfile("""
|
||||
slave.testdir.makepyfile("""
|
||||
import py
|
||||
py.test.skip("hello")
|
||||
""")
|
||||
@@ -187,7 +186,7 @@ class TestSlaveInteractor:
|
||||
assert not ev.kwargs['ids']
|
||||
|
||||
def test_remote_collect_fail(self, slave):
|
||||
p = slave.testdir.makepyfile("""aasd qwe""")
|
||||
slave.testdir.makepyfile("""aasd qwe""")
|
||||
slave.setup()
|
||||
ev = slave.popevent("collectionstart")
|
||||
assert not ev.kwargs
|
||||
@@ -201,7 +200,7 @@ class TestSlaveInteractor:
|
||||
assert not ev.kwargs['ids']
|
||||
|
||||
def test_runtests_all(self, slave):
|
||||
p = slave.testdir.makepyfile("""
|
||||
slave.testdir.makepyfile("""
|
||||
def test_func(): pass
|
||||
def test_func2(): pass
|
||||
""")
|
||||
@@ -228,7 +227,7 @@ class TestSlaveInteractor:
|
||||
def test_happy_run_events_converted(self, testdir, slave):
|
||||
py.test.xfail("implement a simple test for event production")
|
||||
assert not slave.use_callback
|
||||
p = slave.testdir.makepyfile("""
|
||||
slave.testdir.makepyfile("""
|
||||
def test_func():
|
||||
pass
|
||||
""")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import py
|
||||
import os
|
||||
import execnet
|
||||
from xdist.slavemanage import HostRSync, NodeManager
|
||||
|
||||
@@ -108,7 +107,7 @@ class TestHRSync:
|
||||
return mysetup(request)
|
||||
|
||||
def test_hrsync_filter(self, mysetup):
|
||||
source, dest = mysetup.source, mysetup.dest
|
||||
source, _ = mysetup.source, mysetup.dest # noqa
|
||||
source.ensure("dir", "file.txt")
|
||||
source.ensure(".svn", "entries")
|
||||
source.ensure(".somedotfile", "moreentries")
|
||||
@@ -139,7 +138,7 @@ class TestNodeManager:
|
||||
@py.test.mark.xfail
|
||||
def test_rsync_roots_no_roots(self, testdir, mysetup):
|
||||
mysetup.source.ensure("dir1", "file1").write("hello")
|
||||
config = testdir.parseconfig(source)
|
||||
config = testdir.parseconfig(mysetup.source)
|
||||
nodemanager = NodeManager(config, ["popen//chdir=%s" % mysetup.dest])
|
||||
#assert nodemanager.config.topdir == source == config.topdir
|
||||
nodemanager.makegateways()
|
||||
@@ -194,11 +193,11 @@ class TestNodeManager:
|
||||
def test_rsyncignore(self, testdir, mysetup):
|
||||
source, dest = mysetup.source, mysetup.dest
|
||||
dir2 = source.ensure("dir1", "dir2", dir=1)
|
||||
dir5 = source.ensure("dir5", "dir6", "bogus")
|
||||
dirf = source.ensure("dir5", "file")
|
||||
source.ensure("dir5", "dir6", "bogus")
|
||||
source.ensure("dir5", "file")
|
||||
dir2.ensure("hello")
|
||||
dirfoo = source.ensure("foo", "bar")
|
||||
dirbar = source.ensure("bar", "foo")
|
||||
source.ensure("foo", "bar")
|
||||
source.ensure("bar", "foo")
|
||||
source.join("tox.ini").write(py.std.textwrap.dedent("""
|
||||
[pytest]
|
||||
rsyncdirs = dir1 dir5
|
||||
@@ -217,7 +216,7 @@ class TestNodeManager:
|
||||
assert not dest.join('bar').check()
|
||||
|
||||
def test_optimise_popen(self, testdir, mysetup):
|
||||
source, dest = mysetup.source, mysetup.dest
|
||||
source = mysetup.source
|
||||
specs = ["popen"] * 3
|
||||
source.join("conftest.py").write("rsyncdirs = ['a']")
|
||||
source.ensure('a', dir=1)
|
||||
|
||||
7
tox.ini
7
tox.ini
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist=py26,py32,py33,py34,py27,py27-pexpect,py33-pexpect,py26,py26-old,py33-old
|
||||
envlist=py26,py32,py33,py34,py27,py27-pexpect,py33-pexpect,py26,py26-old,py33-old,flakes
|
||||
|
||||
[testenv]
|
||||
changedir=testing
|
||||
@@ -13,6 +13,11 @@ deps={[testenv]deps}
|
||||
deps={[testenv]deps}
|
||||
pexpect
|
||||
|
||||
[testenv:flakes]
|
||||
changedir=
|
||||
deps = pytest-flakes>=0.2
|
||||
commands = py.test --flakes -m flakes testing xdist
|
||||
|
||||
[testenv:py26-old]
|
||||
deps=
|
||||
pytest==2.4.2
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import sys
|
||||
import difflib
|
||||
|
||||
import pytest
|
||||
@@ -295,7 +294,7 @@ class DSession:
|
||||
self.slave_errordown(node, "keyboard-interrupt")
|
||||
return
|
||||
crashitem = self.sched.remove_node(node)
|
||||
#assert not crashitem, (crashitem, node)
|
||||
assert not crashitem, (crashitem, node)
|
||||
if self.shuttingdown and not self.sched.hasnodes():
|
||||
self.session_finished = True
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class RemoteControl(object):
|
||||
result = self.runsession()
|
||||
failures, reports, collection_failed = result
|
||||
if collection_failed:
|
||||
reports = ["Collection failed, keeping previous failure set"]
|
||||
pass # "Collection failed, keeping previous failure set"
|
||||
else:
|
||||
uniq_failures = []
|
||||
for failure in failures:
|
||||
@@ -109,7 +109,6 @@ def repr_pytest_looponfailinfo(failreports, rootdirs):
|
||||
|
||||
def init_slave_session(channel, args, option_dict):
|
||||
import os, sys
|
||||
import py
|
||||
outchannel = channel.gateway.newchannel()
|
||||
sys.stdout = sys.stderr = outchannel.makefile('w')
|
||||
channel.send(outchannel)
|
||||
|
||||
@@ -128,6 +128,7 @@ def remote_initconfig(option_dict, args):
|
||||
|
||||
|
||||
if __name__ == '__channelexec__':
|
||||
channel = channel # noqa
|
||||
# python3.2 is not concurrent import safe, so let's play it safe
|
||||
# https://bitbucket.org/hpk42/pytest/issue/347/pytest-xdist-and-python-32
|
||||
if sys.version_info[:2] == (3,2):
|
||||
|
||||
Reference in New Issue
Block a user