diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 697070e..ec76a1d 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1,4 +1,6 @@ +import os import re +import textwrap import py import pytest @@ -54,8 +56,8 @@ class TestDistribution: def test_n1_skip(self, testdir): p1 = testdir.makepyfile(""" def test_skip(): - import py - py.test.skip("myreason") + import pytest + pytest.skip("myreason") """) result = testdir.runpytest(p1, "-n1") assert result.ret == 0 @@ -78,7 +80,7 @@ class TestDistribution: def test_manytests_to_one_popen(self, testdir): p1 = testdir.makepyfile( """ - import py + import pytest def test_fail0(): assert 0 def test_fail1(): @@ -86,7 +88,7 @@ class TestDistribution: def test_ok(): pass def test_skip(): - py.test.skip("hello") + pytest.skip("hello") """, ) result = testdir.runpytest(p1, "-v", '-d', '--tx=popen', '--tx=popen') result.stdout.fnmatch_lines([ @@ -124,7 +126,7 @@ class TestDistribution: def test_dist_ini_specified(self, testdir): p1 = testdir.makepyfile( """ - import py + import pytest def test_fail0(): assert 0 def test_fail1(): @@ -132,7 +134,7 @@ class TestDistribution: def test_ok(): pass def test_skip(): - py.test.skip("hello") + pytest.skip("hello") """, ) testdir.makeini(""" [pytest] @@ -145,13 +147,13 @@ class TestDistribution: ]) assert result.ret == 1 - @py.test.mark.xfail("sys.platform.startswith('java')", run=False) + @pytest.mark.xfail("sys.platform.startswith('java')", run=False) def test_dist_tests_with_crash(self, testdir): - if not hasattr(py.std.os, 'kill'): - py.test.skip("no os.kill") + if not hasattr(os, 'kill'): + pytest.skip("no os.kill") p1 = testdir.makepyfile(""" - import py + import pytest def test_fail0(): assert 0 def test_fail1(): @@ -159,7 +161,7 @@ class TestDistribution: def test_ok(): pass def test_skip(): - py.test.skip("hello") + pytest.skip("hello") def test_crash(): import time import os @@ -299,7 +301,7 @@ class TestDistEach: assert not result.ret result.stdout.fnmatch_lines(["*2 pass*"]) - @py.test.mark.xfail( + @pytest.mark.xfail( run=False, reason="other python versions might not have py.test installed") def test_simple_diffoutput(self, testdir): @@ -307,7 +309,7 @@ class TestDistEach: for name in ("python2.5", "python2.6"): interp = py.path.local.sysfind(name) if interp is None: - py.test.skip("%s not found" % name) + pytest.skip("%s not found" % name) interpreters.append(interp) testdir.makepyfile( @@ -330,11 +332,11 @@ class TestDistEach: class TestTerminalReporting: def test_pass_skip_fail(self, testdir): testdir.makepyfile(""" - import py + import pytest def test_ok(): pass def test_skip(): - py.test.skip("xx") + pytest.skip("xx") def test_func(): assert 0 """) @@ -421,7 +423,7 @@ def test_teardownfails_one_function(testdir): ["*def teardown_function(function):*", "*1 passed*1 error*"]) -@py.test.mark.xfail +@pytest.mark.xfail def test_terminate_on_hangingnode(testdir): p = testdir.makeconftest(""" def pytest_sessionfinish(session): @@ -585,7 +587,7 @@ def test_skipping(testdir): def test_issue34_pluginloading_in_subprocess(testdir): testdir.tmpdir.join("plugin123.py").write( - py.code.Source(""" + textwrap.dedent(""" def pytest_namespace(): return {'sample_variable': 'testing'} """)) diff --git a/testing/test_remote.py b/testing/test_remote.py index cc21835..b0082d0 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -1,4 +1,5 @@ import py +import pprint import pytest from xdist.workermanage import WorkerController, unserialize_report from xdist.remote import serialize_report @@ -14,7 +15,7 @@ def check_marshallable(d): try: marshal.dumps(d) except ValueError: - py.std.pprint.pprint(d) + pprint.pprint(d) raise ValueError("not marshallable") @@ -344,7 +345,7 @@ class TestWorkerInteractor: for data in worker.slp.channel: worker.slp.process_from_remote(data) worker.slp.process_from_remote(worker.slp.ENDMARK) - py.std.pprint.pprint(hookrec.hookrecorder.calls) + pprint.pprint(hookrec.hookrecorder.calls) hookrec.hookrecorder.contains([ ("pytest_collectstart", "collector.fspath == aaa"), ("pytest_pycollect_makeitem", "name == 'test_func'"), diff --git a/testing/test_slavemanage.py b/testing/test_slavemanage.py index af3201c..3d239fa 100644 --- a/testing/test_slavemanage.py +++ b/testing/test_slavemanage.py @@ -1,5 +1,6 @@ import py import pytest +import textwrap import execnet from _pytest.pytester import HookRecorder from xdist import workermanage, newhooks @@ -198,7 +199,7 @@ class TestNodeManager: source.ensure("dir1", "somefile", dir=1) dir2.ensure("hello") source.ensure("bogusdir", "file") - source.join("tox.ini").write(py.std.textwrap.dedent(""" + source.join("tox.ini").write(textwrap.dedent(""" [pytest] rsyncdirs=dir1/dir2 """)) @@ -217,7 +218,7 @@ class TestNodeManager: dir2.ensure("hello") source.ensure("foo", "bar") source.ensure("bar", "foo") - source.join("tox.ini").write(py.std.textwrap.dedent(""" + source.join("tox.ini").write(textwrap.dedent(""" [pytest] rsyncdirs = dir1 dir5 rsyncignore = dir1/dir2 dir5/dir6 foo* diff --git a/xdist/looponfail.py b/xdist/looponfail.py index bdaf496..18275dc 100644 --- a/xdist/looponfail.py +++ b/xdist/looponfail.py @@ -10,6 +10,7 @@ import py import pytest import sys +import time import execnet @@ -228,7 +229,7 @@ class StatRecorder(object): changed = self.check() if changed: return - py.std.time.sleep(checkinterval) + time.sleep(checkinterval) def check(self, removepycfiles=True): # noqa, too complex changed = False diff --git a/xdist/workermanage.py b/xdist/workermanage.py index c79e5b6..5069961 100644 --- a/xdist/workermanage.py +++ b/xdist/workermanage.py @@ -1,6 +1,7 @@ import fnmatch import os import re +import threading import py import pytest @@ -32,7 +33,7 @@ class NodeManager(object): def __init__(self, config, specs=None, defaultchdir="pyexecnetcache"): self.config = config - self._nodesready = py.std.threading.Event() + self._nodesready = threading.Event() self.trace = self.config.trace.get("nodemanager") self.group = execnet.Group() if specs is None: