diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index 9d6af5d69..f2cb2ab63 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -81,19 +81,12 @@ def _format_lines(lines): return result -# Provide basestring in python3 -try: - basestring = basestring -except NameError: - basestring = str - - def issequence(x): - return isinstance(x, Sequence) and not isinstance(x, basestring) + return isinstance(x, Sequence) and not isinstance(x, str) def istext(x): - return isinstance(x, basestring) + return isinstance(x, str) def isdict(x): diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index 0d2a318ed..749e80f3c 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -114,7 +114,7 @@ def fail(msg="", pytrace=True): fail.Exception = Failed -class XFailed(fail.Exception): +class XFailed(Failed): """ raised from an explicit call to pytest.xfail() """ diff --git a/testing/io/test_saferepr.py b/testing/io/test_saferepr.py index e57b53f81..f6abfe322 100644 --- a/testing/io/test_saferepr.py +++ b/testing/io/test_saferepr.py @@ -15,7 +15,7 @@ def test_maxsize(): def test_maxsize_error_on_instance(): class A: - def __repr__(): + def __repr__(self): raise ValueError("...") s = saferepr(("*" * 50, A()), maxsize=25) diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index 75467fb09..1d39079ea 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -26,10 +26,10 @@ def test_getfuncargnames(): assert fixtures.getfuncargnames(h) == ("arg1",) - def h(arg1, arg2, arg3="hello"): + def j(arg1, arg2, arg3="hello"): pass - assert fixtures.getfuncargnames(h) == ("arg1", "arg2") + assert fixtures.getfuncargnames(j) == ("arg1", "arg2") class A: def f(self, arg1, arg2="hello"): diff --git a/testing/python/raises.py b/testing/python/raises.py index bfcb3dbb1..89cef38f1 100644 --- a/testing/python/raises.py +++ b/testing/python/raises.py @@ -235,7 +235,7 @@ class TestRaises: int("asdf") def test_raises_exception_looks_iterable(self): - class Meta(type(object)): + class Meta(type): def __getitem__(self, item): return 1 / 0 diff --git a/testing/test_pytester.py b/testing/test_pytester.py index 96bf85040..ca12672f5 100644 --- a/testing/test_pytester.py +++ b/testing/test_pytester.py @@ -189,12 +189,7 @@ def test_hookrecorder_basic(holder): def test_makepyfile_unicode(testdir): - global unichr - try: - unichr(65) - except NameError: - unichr = chr - testdir.makepyfile(unichr(0xFFFD)) + testdir.makepyfile(chr(0xFFFD)) def test_makepyfile_utf8(testdir): diff --git a/testing/test_tmpdir.py b/testing/test_tmpdir.py index a7c0ed7ea..c4c7ebe25 100644 --- a/testing/test_tmpdir.py +++ b/testing/test_tmpdir.py @@ -24,7 +24,6 @@ def test_ensuretemp(recwarn): @attr.s class FakeConfig: basetemp = attr.ib() - trace = attr.ib(default=None) @property def trace(self):