All classes now subclass object for better py3 compatibility

Fix #2147
This commit is contained in:
Bruno Oliveira
2018-01-24 18:23:42 -02:00
parent 3b3d237f07
commit af37778b0d
22 changed files with 56 additions and 55 deletions

View File

@@ -171,7 +171,7 @@ def _pytest(request):
return PytestArg(request)
class PytestArg:
class PytestArg(object):
def __init__(self, request):
self.request = request
@@ -186,7 +186,7 @@ def get_public_names(values):
return [x for x in values if x[0] != "_"]
class ParsedCall:
class ParsedCall(object):
def __init__(self, name, kwargs):
self.__dict__.update(kwargs)
self._name = name
@@ -197,7 +197,7 @@ class ParsedCall:
return "<ParsedCall %r(**%r)>" % (self._name, d)
class HookRecorder:
class HookRecorder(object):
"""Record all hooks called in a plugin manager.
This wraps all the hook calls in the plugin manager, recording each call
@@ -343,7 +343,7 @@ def testdir(request, tmpdir_factory):
rex_outcome = re.compile(r"(\d+) ([\w-]+)")
class RunResult:
class RunResult(object):
"""The result of running a command.
Attributes:
@@ -397,7 +397,7 @@ class RunResult:
assert obtained == dict(passed=passed, skipped=skipped, failed=failed, error=error)
class CwdSnapshot:
class CwdSnapshot(object):
def __init__(self):
self.__saved = os.getcwd()
@@ -405,7 +405,7 @@ class CwdSnapshot:
os.chdir(self.__saved)
class SysModulesSnapshot:
class SysModulesSnapshot(object):
def __init__(self, preserve=None):
self.__preserve = preserve
self.__saved = dict(sys.modules)
@@ -418,7 +418,7 @@ class SysModulesSnapshot:
sys.modules.update(self.__saved)
class SysPathsSnapshot:
class SysPathsSnapshot(object):
def __init__(self):
self.__saved = list(sys.path), list(sys.meta_path)
@@ -426,7 +426,7 @@ class SysPathsSnapshot:
sys.path[:], sys.meta_path[:] = self.__saved
class Testdir:
class Testdir(object):
"""Temporary test directory with tools to test/run pytest itself.
This is based on the ``tmpdir`` fixture but provides a number of methods
@@ -740,7 +740,7 @@ class Testdir:
rec = []
class Collect:
class Collect(object):
def pytest_configure(x, config):
rec.append(self.make_hook_recorder(config.pluginmanager))
@@ -750,7 +750,7 @@ class Testdir:
if len(rec) == 1:
reprec = rec.pop()
else:
class reprec:
class reprec(object):
pass
reprec.ret = ret
@@ -780,13 +780,13 @@ class Testdir:
reprec = self.inline_run(*args, **kwargs)
except SystemExit as e:
class reprec:
class reprec(object):
ret = e.args[0]
except Exception:
traceback.print_exc()
class reprec:
class reprec(object):
ret = 3
finally:
out, err = capture.readouterr()
@@ -1067,7 +1067,7 @@ def getdecoded(out):
py.io.saferepr(out),)
class LineComp:
class LineComp(object):
def __init__(self):
self.stringio = py.io.TextIO()
@@ -1085,7 +1085,7 @@ class LineComp:
return LineMatcher(lines1).fnmatch_lines(lines2)
class LineMatcher:
class LineMatcher(object):
"""Flexible matching of text.
This is a convenience class to test large texts like the output of