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

@@ -901,7 +901,7 @@ def test_deferred_hook_checking(testdir):
testdir.syspathinsert()
testdir.makepyfile(**{
'plugin.py': """
class Hooks:
class Hooks(object):
def pytest_my_hook(self, config):
pass

View File

@@ -880,10 +880,10 @@ class TestConftestCustomization(object):
import sys, os, imp
from _pytest.python import Module
class Loader:
class Loader(object):
def load_module(self, name):
return imp.load_source(name, name + ".narf")
class Finder:
class Finder(object):
def find_module(self, name, path=None):
if os.path.exists(name + ".narf"):
return Loader()

View File

@@ -2828,7 +2828,7 @@ class TestShowFixtures(object):
def test_show_fixtures_indented_in_class(self, testdir):
p = testdir.makepyfile(dedent('''
import pytest
class TestClass:
class TestClass(object):
@pytest.fixture
def fixture1(self):
"""line1

View File

@@ -241,7 +241,7 @@ class TestMetafunc(object):
"""
from _pytest.python import _idval
class TestClass:
class TestClass(object):
pass
def test_function():

View File

@@ -1245,7 +1245,7 @@ def test_py36_windowsconsoleio_workaround_non_standard_streams():
"""
from _pytest.capture import _py36_windowsconsoleio_workaround
class DummyStream:
class DummyStream(object):
def write(self, s):
pass

View File

@@ -135,7 +135,7 @@ def test_makepyfile_utf8(testdir):
assert u"mixed_encoding = u'São Paulo'".encode('utf-8') in p.read('rb')
class TestInlineRunModulesCleanup:
class TestInlineRunModulesCleanup(object):
def test_inline_run_test_module_not_cleaned_up(self, testdir):
test_mod = testdir.makepyfile("def test_foo(): assert True")
result = testdir.inline_run(str(test_mod))
@@ -146,7 +146,7 @@ class TestInlineRunModulesCleanup:
assert result2.ret == EXIT_TESTSFAILED
def spy_factory(self):
class SysModulesSnapshotSpy:
class SysModulesSnapshotSpy(object):
instances = []
def __init__(self, preserve=None):
@@ -223,7 +223,7 @@ def test_inline_run_clean_sys_paths(testdir):
assert sys.meta_path == original_meta_path
def spy_factory(self):
class SysPathsSnapshotSpy:
class SysPathsSnapshotSpy(object):
instances = []
def __init__(self):
@@ -266,7 +266,7 @@ def test_cwd_snapshot(tmpdir):
assert py.path.local() == foo
class TestSysModulesSnapshot:
class TestSysModulesSnapshot(object):
key = 'my-test-module'
def test_remove_added(self):
@@ -329,7 +329,7 @@ class TestSysModulesSnapshot:
@pytest.mark.parametrize('path_type', ('path', 'meta_path'))
class TestSysPathsSnapshot:
class TestSysPathsSnapshot(object):
other_path = {
'path': 'meta_path',
'meta_path': 'path'}

View File

@@ -966,7 +966,7 @@ def test_no_trailing_whitespace_after_inifile_word(testdir):
assert 'inifile: tox.ini\n' in result.stdout.str()
class TestProgress:
class TestProgress(object):
@pytest.fixture
def many_tests_files(self, testdir):
@@ -1047,7 +1047,7 @@ class TestProgress:
])
class TestProgressWithTeardown:
class TestProgressWithTeardown(object):
"""Ensure we show the correct percentages for tests that fail during teardown (#3088)"""
@pytest.fixture