Skip to content

Commit d4afa15

Browse files
committed
Refactored old style classes to new style classes
1 parent 3494dd0 commit d4afa15

16 files changed

+49
-49
lines changed

_pytest/_argcomplete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
import os
6363
from glob import glob
6464

65-
class FastFilesCompleter:
65+
class FastFilesCompleter(object):
6666
'Fast file completer class'
6767
def __init__(self, directories=True):
6868
self.directories = directories

_pytest/assertion/__init__.py

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

6161

62-
class AssertionState:
62+
class AssertionState(object):
6363
"""State for the assertion plugin."""
6464

6565
def __init__(self, config, mode):

_pytest/cacheprovider.py

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

8989

90-
class LFPlugin:
90+
class LFPlugin(object):
9191
""" Plugin which implements the --lf (run last-failing) option """
9292
def __init__(self, config):
9393
self.config = config

_pytest/capture.py

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

5959

60-
class CaptureManager:
60+
class CaptureManager(object):
6161
def __init__(self, method):
6262
self._method = method
6363

@@ -182,7 +182,7 @@ def capfd(request):
182182
return c
183183

184184

185-
class CaptureFixture:
185+
class CaptureFixture(object):
186186
def __init__(self, captureclass, request):
187187
self.captureclass = captureclass
188188
self.request = request
@@ -315,10 +315,10 @@ def readouterr(self):
315315
return (self.out.snap() if self.out is not None else "",
316316
self.err.snap() if self.err is not None else "")
317317

318-
class NoCapture:
318+
class NoCapture(object):
319319
__init__ = start = done = suspend = resume = lambda *args: None
320320

321-
class FDCapture:
321+
class FDCapture(object):
322322
""" Capture IO to/from a given os-level filedescriptor. """
323323

324324
def __init__(self, targetfd, tmpfile=None):
@@ -394,7 +394,7 @@ def writeorg(self, data):
394394
os.write(self.targetfd_save, data)
395395

396396

397-
class SysCapture:
397+
class SysCapture(object):
398398
def __init__(self, fd, tmpfile=None):
399399
name = patchsysdict[fd]
400400
self._old = getattr(sys, name)
@@ -432,7 +432,7 @@ def writeorg(self, data):
432432
self._old.flush()
433433

434434

435-
class DontReadFromInput:
435+
class DontReadFromInput(object):
436436
"""Temporary stub class. Ideally when stdin is accessed, the
437437
capturing should be turned off, with possibly all data captured
438438
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
@@ -62,7 +62,7 @@ def main(args=None, plugins=None):
6262
sys.stderr.write("ERROR: %s\n" %(msg,))
6363
return 4
6464

65-
class cmdline: # compatibility namespace
65+
class cmdline(object): # compatibility namespace
6666
main = staticmethod(main)
6767

6868

@@ -447,7 +447,7 @@ def import_plugin(self, modname):
447447
self.consider_module(mod)
448448

449449

450-
class Parser:
450+
class Parser(object):
451451
""" Parser for command line arguments and ini-file values.
452452
453453
:ivar extra_info: dict of generic param -> value to display in case
@@ -582,7 +582,7 @@ def __str__(self):
582582
return self.msg
583583

584584

585-
class Argument:
585+
class Argument(object):
586586
"""class that mimics the necessary behaviour of optparse.Option
587587
588588
its currently a least effort implementation
@@ -712,7 +712,7 @@ def __repr__(self):
712712
return 'Argument({0})'.format(', '.join(args))
713713

714714

715-
class OptionGroup:
715+
class OptionGroup(object):
716716
def __init__(self, name, description="", parser=None):
717717
self.name = name
718718
self.description = description
@@ -838,7 +838,7 @@ def __repr__(self):
838838
def copy(self):
839839
return CmdOptions(self.__dict__)
840840

841-
class Notset:
841+
class Notset(object):
842842
def __repr__(self):
843843
return "<NOTSET>"
844844

_pytest/debugging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def fin():
4343
pytestPDB._pdb_cls = pdb_cls
4444
config._cleanup.append(fin)
4545

46-
class pytestPDB:
46+
class pytestPDB(object):
4747
""" Pseudo PDB that defers to the real pdb. """
4848
_pluginmanager = None
4949
_config = None
@@ -64,7 +64,7 @@ def set_trace(self):
6464
self._pdb_cls().set_trace(frame)
6565

6666

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

_pytest/fixtures.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def slice_items(items, ignore, scoped_argkeys_cache):
222222

223223

224224

225-
class FuncargnamesCompatAttr:
225+
class FuncargnamesCompatAttr(object):
226226
""" helper class so that Metafunc, Function and FixtureRequest
227227
don't need to each define the "funcargnames" compatibility attribute.
228228
"""
@@ -258,7 +258,7 @@ def fillfixtures(function):
258258
def get_direct_param_fixture_func(request):
259259
return request.param
260260

261-
class FuncFixtureInfo:
261+
class FuncFixtureInfo(object):
262262
def __init__(self, argnames, names_closure, name2fixturedefs):
263263
self.argnames = argnames
264264
self.names_closure = names_closure
@@ -456,7 +456,7 @@ def _get_active_fixturedef(self, argname):
456456
fixturedef = self._getnextfixturedef(argname)
457457
except FixtureLookupError:
458458
if argname == "request":
459-
class PseudoFixtureDef:
459+
class PseudoFixtureDef(object):
460460
cached_result = (self, [0], None)
461461
scope = "function"
462462
return PseudoFixtureDef
@@ -723,7 +723,7 @@ def teardown():
723723
return res
724724

725725

726-
class FixtureDef:
726+
class FixtureDef(object):
727727
""" A container for a factory definition. """
728728
def __init__(self, fixturemanager, baseid, argname, func, scope, params,
729729
unittest=False, ids=None):
@@ -822,7 +822,7 @@ def pytest_fixture_setup(fixturedef, request):
822822
return result
823823

824824

825-
class FixtureFunctionMarker:
825+
class FixtureFunctionMarker(object):
826826
def __init__(self, scope, params, autouse=False, ids=None, name=None):
827827
self.scope = scope
828828
self.params = params
@@ -909,7 +909,7 @@ def pytestconfig(request):
909909
return request.config
910910

911911

912-
class FixtureManager:
912+
class FixtureManager(object):
913913
"""
914914
pytest fixtures definitions and information is stored and managed
915915
from this class.

_pytest/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def pytest_ignore_collect(path, config):
179179
return False
180180

181181

182-
class FSHookProxy:
182+
class FSHookProxy(object):
183183
def __init__(self, fspath, pm, remove_mods):
184184
self.fspath = fspath
185185
self.pm = pm

_pytest/mark.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def pytest_collection_modifyitems(items, config):
9999
items[:] = remaining
100100

101101

102-
class MarkMapping:
102+
class MarkMapping(object):
103103
"""Provides a local mapping for markers where item access
104104
resolves to True if the marker is present. """
105105
def __init__(self, keywords):
@@ -113,7 +113,7 @@ def __getitem__(self, name):
113113
return name in self._mymarks
114114

115115

116-
class KeywordMapping:
116+
class KeywordMapping(object):
117117
"""Provides a local mapping for keywords.
118118
Given a list of names, map any substring of one of these names to True.
119119
"""
@@ -173,7 +173,7 @@ def pytest_configure(config):
173173
pytest.mark._config = config
174174

175175

176-
class MarkGenerator:
176+
class MarkGenerator(object):
177177
""" Factory for :class:`MarkDecorator` objects - exposed as
178178
a ``pytest.mark`` singleton instance. Example::
179179
@@ -210,7 +210,7 @@ def istestfunc(func):
210210
return hasattr(func, "__call__") and \
211211
getattr(func, "__name__", "<lambda>") != "<lambda>"
212212

213-
class MarkDecorator:
213+
class MarkDecorator(object):
214214
""" A decorator for test functions and test classes. When applied
215215
it will create :class:`MarkInfo` objects which may be
216216
:ref:`retrieved by hooks as item keywords <excontrolskip>`.

_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

_pytest/pytester.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def _pytest(request):
165165
"""
166166
return PytestArg(request)
167167

168-
class PytestArg:
168+
class PytestArg(object):
169169
def __init__(self, request):
170170
self.request = request
171171

@@ -180,7 +180,7 @@ def get_public_names(l):
180180
return [x for x in l if x[0] != "_"]
181181

182182

183-
class ParsedCall:
183+
class ParsedCall(object):
184184
def __init__(self, name, kwargs):
185185
self.__dict__.update(kwargs)
186186
self._name = name
@@ -191,7 +191,7 @@ def __repr__(self):
191191
return "<ParsedCall %r(**%r)>" %(self._name, d)
192192

193193

194-
class HookRecorder:
194+
class HookRecorder(object):
195195
"""Record all hooks called in a plugin manager.
196196
197197
This wraps all the hook calls in the plugin manager, recording
@@ -335,7 +335,7 @@ def testdir(request, tmpdir_factory):
335335

336336

337337
rex_outcome = re.compile("(\d+) ([\w-]+)")
338-
class RunResult:
338+
class RunResult(object):
339339
"""The result of running a command.
340340
341341
Attributes:
@@ -380,7 +380,7 @@ def assert_outcomes(self, passed=0, skipped=0, failed=0):
380380

381381

382382

383-
class Testdir:
383+
class Testdir(object):
384384
"""Temporary test directory with tools to test/run pytest itself.
385385
386386
This is based on the ``tmpdir`` fixture but provides a number of
@@ -707,7 +707,7 @@ def revert():
707707

708708
rec = []
709709

710-
class Collect:
710+
class Collect(object):
711711
def pytest_configure(x, config):
712712
rec.append(self.make_hook_recorder(config.pluginmanager))
713713

@@ -718,7 +718,7 @@ def pytest_configure(x, config):
718718
if len(rec) == 1:
719719
reprec = rec.pop()
720720
else:
721-
class reprec:
721+
class reprec(object):
722722
pass
723723
reprec.ret = ret
724724

@@ -742,13 +742,13 @@ def runpytest_inprocess(self, *args, **kwargs):
742742
reprec = self.inline_run(*args, **kwargs)
743743
except SystemExit as e:
744744

745-
class reprec:
745+
class reprec(object):
746746
ret = e.args[0]
747747

748748
except Exception:
749749
traceback.print_exc()
750750

751-
class reprec:
751+
class reprec(object):
752752
ret = 3
753753
finally:
754754
out, err = capture.reset()
@@ -1033,7 +1033,7 @@ def getdecoded(out):
10331033
py.io.saferepr(out),)
10341034

10351035

1036-
class LineComp:
1036+
class LineComp(object):
10371037
def __init__(self):
10381038
self.stringio = py.io.TextIO()
10391039

@@ -1049,7 +1049,7 @@ def assert_contains_lines(self, lines2):
10491049
return LineMatcher(lines1).fnmatch_lines(lines2)
10501050

10511051

1052-
class LineMatcher:
1052+
class LineMatcher(object):
10531053
"""Flexible matching of text.
10541054
10551055
This is a convenience class to test large texts like the output of

_pytest/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def pytest_sessionstart(session):
5555
def pytest_sessionfinish(session):
5656
session._setupstate.teardown_all()
5757

58-
class NodeInfo:
58+
class NodeInfo(object):
5959
def __init__(self, location):
6060
self.location = location
6161

@@ -150,7 +150,7 @@ def call_runtest_hook(item, when, **kwds):
150150
ihook = getattr(item.ihook, hookname)
151151
return CallInfo(lambda: ihook(item=item, **kwds), when=when)
152152

153-
class CallInfo:
153+
class CallInfo(object):
154154
""" Result/Exception info a function invocation. """
155155
#: None or ExceptionInfo object.
156156
excinfo = None

_pytest/skipping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def xfail(reason=""):
7272
xfail.Exception = XFailed
7373

7474

75-
class MarkEvaluator:
75+
class MarkEvaluator(object):
7676
def __init__(self, item, name):
7777
self.item = item
7878
self.name = name

_pytest/terminal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ def pytest_report_teststatus(report):
8080
letter = "f"
8181
return report.outcome, letter, report.outcome.upper()
8282

83-
class WarningReport:
83+
class WarningReport(object):
8484
def __init__(self, code, message, nodeid=None, fslocation=None):
8585
self.code = code
8686
self.message = message
8787
self.nodeid = nodeid
8888
self.fslocation = fslocation
8989

9090

91-
class TerminalReporter:
91+
class TerminalReporter(object):
9292
def __init__(self, config, file=None):
9393
import _pytest.config
9494
self.config = config

0 commit comments

Comments
 (0)