From f1183c242275eafd5ad5e594bd631f694c18833a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 27 Apr 2019 11:25:37 -0300 Subject: [PATCH] Remove the 'issue' marker from test suite It doesn't seem to add much value (why would one execute tests based on that marker?), plus using the docstring for that encourages one to write a more descriptive message about the test --- testing/python/fixtures.py | 9 ++++--- testing/python/integration.py | 3 ++- testing/python/metafunc.py | 44 +++++++++++++++++++++-------------- testing/test_capture.py | 2 +- testing/test_conftest.py | 2 +- testing/test_mark.py | 6 ++--- testing/test_recwarn.py | 2 +- testing/test_tmpdir.py | 2 +- testing/test_unittest.py | 2 +- tox.ini | 1 - 10 files changed, 40 insertions(+), 33 deletions(-) diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index 41627680d..18ede4006 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -1925,10 +1925,10 @@ class TestAutouseManagement(object): reprec = testdir.inline_run() reprec.assertoutcome(passed=1) - @pytest.mark.issue(226) @pytest.mark.parametrize("param1", ["", "params=[1]"], ids=["p00", "p01"]) @pytest.mark.parametrize("param2", ["", "params=[1]"], ids=["p10", "p11"]) def test_ordering_dependencies_torndown_first(self, testdir, param1, param2): + """#226""" testdir.makepyfile( """ import pytest @@ -2707,9 +2707,9 @@ class TestFixtureMarker(object): reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=5) - @pytest.mark.issue(246) @pytest.mark.parametrize("scope", ["session", "function", "module"]) def test_finalizer_order_on_parametrization(self, scope, testdir): + """#246""" testdir.makepyfile( """ import pytest @@ -2744,8 +2744,8 @@ class TestFixtureMarker(object): reprec = testdir.inline_run("-lvs") reprec.assertoutcome(passed=3) - @pytest.mark.issue(396) def test_class_scope_parametrization_ordering(self, testdir): + """#396""" testdir.makepyfile( """ import pytest @@ -2865,8 +2865,8 @@ class TestFixtureMarker(object): res = testdir.runpytest("-v") res.stdout.fnmatch_lines(["*test_foo*alpha*", "*test_foo*beta*"]) - @pytest.mark.issue(920) def test_deterministic_fixture_collection(self, testdir, monkeypatch): + """#920""" testdir.makepyfile( """ import pytest @@ -3649,7 +3649,6 @@ class TestScopeOrdering(object): """Class of tests that ensure fixtures are ordered based on their scopes (#2405)""" @pytest.mark.parametrize("variant", ["mark", "autouse"]) - @pytest.mark.issue(github="#2405") def test_func_closure_module_auto(self, testdir, variant, monkeypatch): """Semantically identical to the example posted in #2405 when ``use_mark=True``""" monkeypatch.setenv("FIXTURE_ACTIVATION_VARIANT", variant) diff --git a/testing/python/integration.py b/testing/python/integration.py index 3c6eecbe1..a62747014 100644 --- a/testing/python/integration.py +++ b/testing/python/integration.py @@ -393,8 +393,9 @@ class TestNoselikeTestAttribute(object): assert not call.items -@pytest.mark.issue(351) class TestParameterize(object): + """#351""" + def test_idfn_marker(self, testdir): testdir.makepyfile( """ diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index c3429753e..29f18da36 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -159,8 +159,9 @@ class TestMetafunc(object): ("x", "y"), [("abc", "def"), ("ghi", "jkl")], ids=["one"] ) - @pytest.mark.issue(510) def test_parametrize_empty_list(self): + """#510""" + def func(y): pass @@ -262,8 +263,8 @@ class TestMetafunc(object): for val, expected in values: assert _idval(val, "a", 6, None, item=None, config=None) == expected - @pytest.mark.issue(250) def test_idmaker_autoname(self): + """#250""" from _pytest.python import idmaker result = idmaker( @@ -356,8 +357,8 @@ class TestMetafunc(object): result = idmaker(("a", "b"), [pytest.param(e.one, e.two)]) assert result == ["Foo.one-Foo.two"] - @pytest.mark.issue(351) def test_idmaker_idfn(self): + """#351""" from _pytest.python import idmaker def ids(val): @@ -375,8 +376,8 @@ class TestMetafunc(object): ) assert result == ["10.0-IndexError()", "20-KeyError()", "three-b2"] - @pytest.mark.issue(351) def test_idmaker_idfn_unique_names(self): + """#351""" from _pytest.python import idmaker def ids(val): @@ -459,8 +460,9 @@ class TestMetafunc(object): ) assert result == ["a0", "a1", "b0", "c", "b1"] - @pytest.mark.issue(714) def test_parametrize_indirect(self): + """#714""" + def func(x, y): pass @@ -473,8 +475,9 @@ class TestMetafunc(object): assert metafunc._calls[0].params == dict(x=1, y=2) assert metafunc._calls[1].params == dict(x=1, y=3) - @pytest.mark.issue(714) def test_parametrize_indirect_list(self): + """#714""" + def func(x, y): pass @@ -483,8 +486,9 @@ class TestMetafunc(object): assert metafunc._calls[0].funcargs == dict(y="b") assert metafunc._calls[0].params == dict(x="a") - @pytest.mark.issue(714) def test_parametrize_indirect_list_all(self): + """#714""" + def func(x, y): pass @@ -493,8 +497,9 @@ class TestMetafunc(object): assert metafunc._calls[0].funcargs == {} assert metafunc._calls[0].params == dict(x="a", y="b") - @pytest.mark.issue(714) def test_parametrize_indirect_list_empty(self): + """#714""" + def func(x, y): pass @@ -503,9 +508,9 @@ class TestMetafunc(object): assert metafunc._calls[0].funcargs == dict(x="a", y="b") assert metafunc._calls[0].params == {} - @pytest.mark.issue(714) def test_parametrize_indirect_list_functional(self, testdir): """ + #714 Test parametrization with 'indirect' parameter applied on particular arguments. As y is is direct, its value should be used directly rather than being passed to the fixture @@ -532,8 +537,9 @@ class TestMetafunc(object): result = testdir.runpytest("-v") result.stdout.fnmatch_lines(["*test_simple*a-b*", "*1 passed*"]) - @pytest.mark.issue(714) def test_parametrize_indirect_list_error(self, testdir): + """#714""" + def func(x, y): pass @@ -541,12 +547,13 @@ class TestMetafunc(object): with pytest.raises(pytest.fail.Exception): metafunc.parametrize("x, y", [("a", "b")], indirect=["x", "z"]) - @pytest.mark.issue(714) def test_parametrize_uses_no_fixture_error_indirect_false(self, testdir): """The 'uses no fixture' error tells the user at collection time that the parametrize data they've set up doesn't correspond to the fixtures in their test function, rather than silently ignoring this and letting the test potentially pass. + + #714 """ testdir.makepyfile( """ @@ -560,8 +567,8 @@ class TestMetafunc(object): result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines(["*uses no argument 'y'*"]) - @pytest.mark.issue(714) def test_parametrize_uses_no_fixture_error_indirect_true(self, testdir): + """#714""" testdir.makepyfile( """ import pytest @@ -580,8 +587,8 @@ class TestMetafunc(object): result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines(["*uses no fixture 'y'*"]) - @pytest.mark.issue(714) def test_parametrize_indirect_uses_no_fixture_error_indirect_string(self, testdir): + """#714""" testdir.makepyfile( """ import pytest @@ -597,8 +604,8 @@ class TestMetafunc(object): result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines(["*uses no fixture 'y'*"]) - @pytest.mark.issue(714) def test_parametrize_indirect_uses_no_fixture_error_indirect_list(self, testdir): + """#714""" testdir.makepyfile( """ import pytest @@ -614,8 +621,8 @@ class TestMetafunc(object): result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines(["*uses no fixture 'y'*"]) - @pytest.mark.issue(714) def test_parametrize_argument_not_in_indirect_list(self, testdir): + """#714""" testdir.makepyfile( """ import pytest @@ -1201,9 +1208,9 @@ class TestMetafuncFunctional(object): reprec = testdir.runpytest() reprec.assert_outcomes(passed=4) - @pytest.mark.issue(463) @pytest.mark.parametrize("attr", ["parametrise", "parameterize", "parameterise"]) def test_parametrize_misspelling(self, testdir, attr): + """#463""" testdir.makepyfile( """ import pytest @@ -1386,8 +1393,9 @@ class TestMetafuncFunctionalAuto(object): assert output.count("preparing foo-3") == 1 -@pytest.mark.issue(308) class TestMarkersWithParametrization(object): + """#308""" + def test_simple_mark(self, testdir): s = """ import pytest @@ -1575,8 +1583,8 @@ class TestMarkersWithParametrization(object): reprec = testdir.inline_run(SHOW_PYTEST_WARNINGS_ARG) reprec.assertoutcome(passed=2, skipped=2) - @pytest.mark.issue(290) def test_parametrize_ID_generation_string_int_works(self, testdir): + """#290""" testdir.makepyfile( """ import pytest diff --git a/testing/test_capture.py b/testing/test_capture.py index 2b450c189..5d80eb63d 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -605,8 +605,8 @@ class TestCaptureFixture(object): result.stdout.fnmatch_lines(["*KeyboardInterrupt*"]) assert result.ret == 2 - @pytest.mark.issue(14) def test_capture_and_logging(self, testdir): + """#14""" p = testdir.makepyfile( """\ import logging diff --git a/testing/test_conftest.py b/testing/test_conftest.py index a0458e595..acb9b52b4 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -491,10 +491,10 @@ class TestConftestVisibility(object): ("snc", ".", 1), ], ) - @pytest.mark.issue(616) def test_parsefactories_relative_node_ids( self, testdir, chdir, testarg, expect_ntests_passed ): + """#616""" dirs = self._setup_tree(testdir) print("pytest run in cwd: %s" % (dirs[chdir].relto(testdir.tmpdir))) print("pytestarg : %s" % (testarg)) diff --git a/testing/test_mark.py b/testing/test_mark.py index 294a1ee6b..03cd2f78c 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -452,8 +452,8 @@ class TestFunctional(object): items, rec = testdir.inline_genitems(p) self.assert_markers(items, test_foo=("a", "b"), test_bar=("a",)) - @pytest.mark.issue(568) def test_mark_should_not_pass_to_siebling_class(self, testdir): + """#568""" p = testdir.makepyfile( """ import pytest @@ -655,9 +655,9 @@ class TestFunctional(object): markers = {m.name for m in items[name].iter_markers()} assert markers == set(expected_markers) - @pytest.mark.issue(1540) @pytest.mark.filterwarnings("ignore") def test_mark_from_parameters(self, testdir): + """#1540""" testdir.makepyfile( """ import pytest @@ -943,9 +943,9 @@ def test_addmarker_order(): assert extracted == ["c", "a", "b"] -@pytest.mark.issue("https://github.com/pytest-dev/pytest/issues/3605") @pytest.mark.filterwarnings("ignore") def test_markers_from_parametrize(testdir): + """#3605""" testdir.makepyfile( """ from __future__ import print_function diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index 9bf6a2ffb..982e246d7 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -47,8 +47,8 @@ class TestWarningsRecorderChecker(object): assert values is rec.list pytest.raises(AssertionError, rec.pop) - @pytest.mark.issue(4243) def test_warn_stacklevel(self): + """#4243""" rec = WarningsRecorder() with rec: warnings.warn("test", DeprecationWarning, 2) diff --git a/testing/test_tmpdir.py b/testing/test_tmpdir.py index 3b7a4ddc3..c49f7930d 100644 --- a/testing/test_tmpdir.py +++ b/testing/test_tmpdir.py @@ -58,8 +58,8 @@ class TestTempdirHandler(object): assert tmp2.relto(t.getbasetemp()).startswith("this") assert tmp2 != tmp - @pytest.mark.issue(4425) def test_tmppath_relative_basetemp_absolute(self, tmp_path, monkeypatch): + """#4425""" from _pytest.tmpdir import TempPathFactory monkeypatch.chdir(tmp_path) diff --git a/testing/test_unittest.py b/testing/test_unittest.py index a519ec255..78250dae3 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -930,11 +930,11 @@ def test_class_method_containing_test_issue1558(testdir): reprec.assertoutcome(passed=1) -@pytest.mark.issue(3498) @pytest.mark.parametrize( "base", ["six.moves.builtins.object", "unittest.TestCase", "unittest2.TestCase"] ) def test_usefixtures_marker_on_unittest(base, testdir): + """#3498""" module = base.rsplit(".", 1)[0] pytest.importorskip(module) testdir.makepyfile( diff --git a/tox.ini b/tox.ini index 3c1ca65b7..e9517b63c 100644 --- a/tox.ini +++ b/tox.ini @@ -172,7 +172,6 @@ filterwarnings = ignore::_pytest.warning_types.PytestUnknownMarkWarning pytester_example_dir = testing/example_scripts markers = - issue slow [flake8]