fix flakes issues and make --flakes run part of tox runs
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import pytest, py, sys
|
||||
from _pytest import python as funcargs
|
||||
from _pytest.python import FixtureLookupError
|
||||
import pytest, py
|
||||
|
||||
class TestModule:
|
||||
def test_failing_import(self, testdir):
|
||||
@@ -32,7 +30,7 @@ class TestModule:
|
||||
|
||||
def test_module_considers_pluginmanager_at_import(self, testdir):
|
||||
modcol = testdir.getmodulecol("pytest_plugins='xasdlkj',")
|
||||
pytest.raises(ImportError, "modcol.obj")
|
||||
pytest.raises(ImportError, lambda: modcol.obj)
|
||||
|
||||
class TestClass:
|
||||
def test_class_with_init_skip_collect(self, testdir):
|
||||
@@ -606,7 +604,7 @@ class TestReportInfo:
|
||||
return MyFunction(name, parent=collector)
|
||||
""")
|
||||
item = testdir.getitem("def test_func(): pass")
|
||||
runner = item.config.pluginmanager.getplugin("runner")
|
||||
item.config.pluginmanager.getplugin("runner")
|
||||
assert item.location == ("ABCDE", 42, "custom")
|
||||
|
||||
def test_func_reportinfo(self, testdir):
|
||||
@@ -696,7 +694,7 @@ def test_customized_python_discovery_functions(testdir):
|
||||
[pytest]
|
||||
python_functions=_test
|
||||
""")
|
||||
p = testdir.makepyfile("""
|
||||
testdir.makepyfile("""
|
||||
def _test_underscore():
|
||||
pass
|
||||
""")
|
||||
|
||||
@@ -247,7 +247,7 @@ class TestFillFixtures:
|
||||
assert result.ret == 0
|
||||
|
||||
def test_funcarg_lookup_error(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
testdir.makepyfile("""
|
||||
def test_lookup_error(unknown):
|
||||
pass
|
||||
""")
|
||||
@@ -307,7 +307,7 @@ class TestRequestBasic:
|
||||
def pytest_funcarg__something(request):
|
||||
return 1
|
||||
""")
|
||||
item = testdir.makepyfile("""
|
||||
testdir.makepyfile("""
|
||||
def pytest_funcarg__something(request):
|
||||
return request.getfuncargvalue("something") + 1
|
||||
def test_func(something):
|
||||
@@ -634,13 +634,13 @@ class TestRequestCachedSetup:
|
||||
l.append("setup")
|
||||
def teardown(val):
|
||||
l.append("teardown")
|
||||
ret1 = req1.cached_setup(setup, teardown, scope="function")
|
||||
req1.cached_setup(setup, teardown, scope="function")
|
||||
assert l == ['setup']
|
||||
# artificial call of finalizer
|
||||
setupstate = req1._pyfuncitem.session._setupstate
|
||||
setupstate._callfinalizers(item1)
|
||||
assert l == ["setup", "teardown"]
|
||||
ret2 = req1.cached_setup(setup, teardown, scope="function")
|
||||
req1.cached_setup(setup, teardown, scope="function")
|
||||
assert l == ["setup", "teardown", "setup"]
|
||||
setupstate._callfinalizers(item1)
|
||||
assert l == ["setup", "teardown", "setup", "teardown"]
|
||||
@@ -1461,7 +1461,7 @@ class TestFixtureMarker:
|
||||
'request.getfuncargvalue("arg")',
|
||||
'request.cached_setup(lambda: None, scope="function")',
|
||||
], ids=["getfuncargvalue", "cached_setup"])
|
||||
def test_scope_mismatch(self, testdir, method):
|
||||
def test_scope_mismatch_various(self, testdir, method):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
finalized = []
|
||||
@@ -1609,7 +1609,7 @@ class TestFixtureMarker:
|
||||
""")
|
||||
|
||||
def test_class_ordering(self, testdir):
|
||||
p = testdir.makeconftest("""
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
||||
l = []
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import pytest, py, sys
|
||||
import pytest
|
||||
from _pytest import runner
|
||||
|
||||
class TestOEJSKITSpecials:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
import pytest, py, sys
|
||||
import pytest, py
|
||||
from _pytest import python as funcargs
|
||||
from _pytest.python import FixtureLookupError
|
||||
|
||||
class TestMetafunc:
|
||||
def Metafunc(self, func):
|
||||
|
||||
@@ -29,7 +29,7 @@ class TestRaises:
|
||||
def test_raises_flip_builtin_AssertionError(self):
|
||||
# we replace AssertionError on python level
|
||||
# however c code might still raise the builtin one
|
||||
from _pytest.assertion.util import BuiltinAssertionError
|
||||
from _pytest.assertion.util import BuiltinAssertionError # noqa
|
||||
pytest.raises(AssertionError,"""
|
||||
raise BuiltinAssertionError
|
||||
""")
|
||||
|
||||
Reference in New Issue
Block a user