Skip to content

Commit b8be339

Browse files
authored
Merge pull request #3148 from nicoddemus/deprecate-old-style-classes-2147
All classes now subclass object for better py3 compatibility
2 parents 2aad8c0 + af37778 commit b8be339

22 files changed

+56
-55
lines changed

_pytest/_argcomplete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
from glob import glob
6161

6262

63-
class FastFilesCompleter:
63+
class FastFilesCompleter(object):
6464
'Fast file completer class'
6565

6666
def __init__(self, directories=True):

_pytest/assertion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def mark_rewrite(self, *names):
5656
pass
5757

5858

59-
class AssertionState:
59+
class AssertionState(object):
6060
"""State for the assertion plugin."""
6161

6262
def __init__(self, config, mode):

_pytest/cacheprovider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def set(self, key, value):
9898
json.dump(value, f, indent=2, sort_keys=True)
9999

100100

101-
class LFPlugin:
101+
class LFPlugin(object):
102102
""" Plugin which implements the --lf (run last-failing) option """
103103

104104
def __init__(self, config):

_pytest/capture.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def silence_logging_at_shutdown():
6161
sys.stderr.write(err)
6262

6363

64-
class CaptureManager:
64+
class CaptureManager(object):
6565
"""
6666
Capture plugin, manages that the appropriate capture method is enabled/disabled during collection and each
6767
test phase (setup, call, teardown). After each of those points, the captured output is obtained and
@@ -271,7 +271,7 @@ def _install_capture_fixture_on_item(request, capture_class):
271271
del request.node._capture_fixture
272272

273273

274-
class CaptureFixture:
274+
class CaptureFixture(object):
275275
def __init__(self, captureclass, request):
276276
self.captureclass = captureclass
277277
self.request = request
@@ -416,11 +416,11 @@ def readouterr(self):
416416
self.err.snap() if self.err is not None else "")
417417

418418

419-
class NoCapture:
419+
class NoCapture(object):
420420
__init__ = start = done = suspend = resume = lambda *args: None
421421

422422

423-
class FDCaptureBinary:
423+
class FDCaptureBinary(object):
424424
"""Capture IO to/from a given os-level filedescriptor.
425425
426426
snap() produces `bytes`
@@ -506,7 +506,7 @@ def snap(self):
506506
return res
507507

508508

509-
class SysCapture:
509+
class SysCapture(object):
510510
def __init__(self, fd, tmpfile=None):
511511
name = patchsysdict[fd]
512512
self._old = getattr(sys, name)
@@ -551,7 +551,7 @@ def snap(self):
551551
return res
552552

553553

554-
class DontReadFromInput:
554+
class DontReadFromInput(object):
555555
"""Temporary stub class. Ideally when stdin is accessed, the
556556
capturing should be turned off, with possibly all data captured
557557
so far sent to the screen. This should be configurable, though,

_pytest/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def main(args=None, plugins=None):
6666
return 4
6767

6868

69-
class cmdline: # compatibility namespace
69+
class cmdline(object): # compatibility namespace
7070
main = staticmethod(main)
7171

7272

@@ -463,7 +463,7 @@ def _get_plugin_specs_as_list(specs):
463463
return []
464464

465465

466-
class Parser:
466+
class Parser(object):
467467
""" Parser for command line arguments and ini-file values.
468468
469469
:ivar extra_info: dict of generic param -> value to display in case
@@ -598,7 +598,7 @@ def __str__(self):
598598
return self.msg
599599

600600

601-
class Argument:
601+
class Argument(object):
602602
"""class that mimics the necessary behaviour of optparse.Option
603603
604604
its currently a least effort implementation
@@ -728,7 +728,7 @@ def __repr__(self):
728728
return 'Argument({0})'.format(', '.join(args))
729729

730730

731-
class OptionGroup:
731+
class OptionGroup(object):
732732
def __init__(self, name, description="", parser=None):
733733
self.name = name
734734
self.description = description
@@ -859,7 +859,7 @@ def copy(self):
859859
return CmdOptions(self.__dict__)
860860

861861

862-
class Notset:
862+
class Notset(object):
863863
def __repr__(self):
864864
return "<NOTSET>"
865865

_pytest/debugging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def fin():
4040
config._cleanup.append(fin)
4141

4242

43-
class pytestPDB:
43+
class pytestPDB(object):
4444
""" Pseudo PDB that defers to the real pdb. """
4545
_pluginmanager = None
4646
_config = None
@@ -62,7 +62,7 @@ def set_trace(cls):
6262
cls._pdb_cls().set_trace(frame)
6363

6464

65-
class PdbInvoke:
65+
class PdbInvoke(object):
6666
def pytest_exception_interact(self, node, call, report):
6767
capman = node.config.pluginmanager.getplugin("capturemanager")
6868
if capman:

_pytest/fixtures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def get_direct_param_fixture_func(request):
247247
return request.param
248248

249249

250-
class FuncFixtureInfo:
250+
class FuncFixtureInfo(object):
251251
def __init__(self, argnames, names_closure, name2fixturedefs):
252252
self.argnames = argnames
253253
self.names_closure = names_closure
@@ -443,7 +443,7 @@ def _get_active_fixturedef(self, argname):
443443
fixturedef = self._getnextfixturedef(argname)
444444
except FixtureLookupError:
445445
if argname == "request":
446-
class PseudoFixtureDef:
446+
class PseudoFixtureDef(object):
447447
cached_result = (self, [0], None)
448448
scope = "function"
449449
return PseudoFixtureDef
@@ -719,7 +719,7 @@ def teardown():
719719
return res
720720

721721

722-
class FixtureDef:
722+
class FixtureDef(object):
723723
""" A container for a factory definition. """
724724

725725
def __init__(self, fixturemanager, baseid, argname, func, scope, params,
@@ -925,7 +925,7 @@ def pytestconfig(request):
925925
return request.config
926926

927927

928-
class FixtureManager:
928+
class FixtureManager(object):
929929
"""
930930
pytest fixtures definitions and information is stored and managed
931931
from this class.

_pytest/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def find_module_patched(self, fullname, path=None):
243243
yield
244244

245245

246-
class FSHookProxy:
246+
class FSHookProxy(object):
247247
def __init__(self, fspath, pm, remove_mods):
248248
self.fspath = fspath
249249
self.pm = pm

_pytest/mark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def pytest_unconfigure(config):
284284
MARK_GEN._config = getattr(config, '_old_mark_config', None)
285285

286286

287-
class MarkGenerator:
287+
class MarkGenerator(object):
288288
""" Factory for :class:`MarkDecorator` objects - exposed as
289289
a ``pytest.mark`` singleton instance. Example::
290290

_pytest/monkeypatch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ def derive_importpath(import_path, raising):
8888
return attr, target
8989

9090

91-
class Notset:
91+
class Notset(object):
9292
def __repr__(self):
9393
return "<notset>"
9494

9595

9696
notset = Notset()
9797

9898

99-
class MonkeyPatch:
99+
class MonkeyPatch(object):
100100
""" Object returned by the ``monkeypatch`` fixture keeping a record of setattr/item/env/syspath changes.
101101
"""
102102

0 commit comments

Comments
 (0)