Replace py.std with stdlib imports

This commit is contained in:
Anthony Sottile
2017-12-26 19:47:26 -08:00
parent 962aede290
commit bd1d17e8de
22 changed files with 117 additions and 106 deletions

View File

@@ -4,7 +4,6 @@ import sys
from textwrap import dedent
import _pytest._code
import py
import pytest
from _pytest.main import (
Collector,
@@ -25,7 +24,7 @@ class TestModule(object):
b = testdir.mkdir("b")
p = a.ensure("test_whatever.py")
p.pyimport()
del py.std.sys.modules['test_whatever']
del sys.modules['test_whatever']
b.ensure("test_whatever.py")
result = testdir.runpytest()
result.stdout.fnmatch_lines([
@@ -754,7 +753,7 @@ class TestSorting(object):
assert fn1 == fn2
assert fn1 != modcol
if py.std.sys.version_info < (3, 0):
if sys.version_info < (3, 0):
assert cmp(fn1, fn2) == 0
assert hash(fn1) == hash(fn2)

View File

@@ -730,7 +730,7 @@ class TestMetafuncFunctional(object):
def test_attributes(self, testdir):
p = testdir.makepyfile("""
# assumes that generate/provide runs in the same process
import py, pytest
import sys, pytest
def pytest_generate_tests(metafunc):
metafunc.addcall(param=metafunc)
@@ -749,7 +749,7 @@ class TestMetafuncFunctional(object):
def test_method(self, metafunc, pytestconfig):
assert metafunc.config == pytestconfig
assert metafunc.module.__name__ == __name__
if py.std.sys.version_info > (3, 0):
if sys.version_info > (3, 0):
unbound = TestClass.test_method
else:
unbound = TestClass.test_method.im_func