Skip to content

Commit

Permalink
Remove the 'issue' marker from test suite
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicoddemus committed May 9, 2019
1 parent 685ca96 commit f1183c2
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 33 deletions.
9 changes: 4 additions & 5 deletions testing/python/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,10 +1925,10 @@ def test_hello(arg1):
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
Expand Down Expand Up @@ -2707,9 +2707,9 @@ def test_3():
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
Expand Down Expand Up @@ -2744,8 +2744,8 @@ def test_other():
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
Expand Down Expand Up @@ -2865,8 +2865,8 @@ def test_foo(fix):
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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion testing/python/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ def test_blah(self):
assert not call.items


@pytest.mark.issue(351)
class TestParameterize(object):
"""#351"""

def test_idfn_marker(self, testdir):
testdir.makepyfile(
"""
Expand Down
44 changes: 26 additions & 18 deletions testing/python/metafunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def func(x, y):
("x", "y"), [("abc", "def"), ("ghi", "jkl")], ids=["one"]
)

@pytest.mark.issue(510)
def test_parametrize_empty_list(self):
"""#510"""

def func(y):
pass

Expand Down Expand Up @@ -262,8 +263,8 @@ def test_function():
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(
Expand Down Expand Up @@ -356,8 +357,8 @@ def test_idmaker_enum(self):
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):
Expand All @@ -375,8 +376,8 @@ def ids(val):
)
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):
Expand Down Expand Up @@ -459,8 +460,9 @@ def test_idmaker_with_ids_unique_names(self):
)
assert result == ["a0", "a1", "b0", "c", "b1"]

@pytest.mark.issue(714)
def test_parametrize_indirect(self):
"""#714"""

def func(x, y):
pass

Expand All @@ -473,8 +475,9 @@ def func(x, y):
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

Expand All @@ -483,8 +486,9 @@ def func(x, y):
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

Expand All @@ -493,8 +497,9 @@ def func(x, y):
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

Expand All @@ -503,9 +508,9 @@ def func(x, y):
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
Expand All @@ -532,21 +537,23 @@ def test_simple(x,y):
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

metafunc = self.Metafunc(func)
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(
"""
Expand All @@ -560,8 +567,8 @@ def test_simple(x):
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
Expand All @@ -580,8 +587,8 @@ def test_simple(x):
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
Expand All @@ -597,8 +604,8 @@ def test_simple(x):
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
Expand All @@ -614,8 +621,8 @@ def test_simple(x):
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
Expand Down Expand Up @@ -1201,9 +1208,9 @@ def test_foo(x):
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
Expand Down Expand Up @@ -1386,8 +1393,9 @@ def pytest_generate_tests(metafunc):
assert output.count("preparing foo-3") == 1


@pytest.mark.issue(308)
class TestMarkersWithParametrization(object):
"""#308"""

def test_simple_mark(self, testdir):
s = """
import pytest
Expand Down Expand Up @@ -1575,8 +1583,8 @@ def test_increment(n, expected):
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
Expand Down
2 changes: 1 addition & 1 deletion testing/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ def test_hello(capfd):
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
Expand Down
2 changes: 1 addition & 1 deletion testing/test_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ def test_no_conftest(fxtr):
("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))
Expand Down
6 changes: 3 additions & 3 deletions testing/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ def test_bar(self): pass
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
Expand Down Expand Up @@ -655,9 +655,9 @@ def assert_markers(self, items, **expected):
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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testing/test_recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_recording(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion testing/test_tmpdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def test_mktemp(self, tmp_path):
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)
Expand Down
2 changes: 1 addition & 1 deletion testing/test_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,11 +930,11 @@ def test_should_not_run(self):
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(
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ filterwarnings =
ignore::_pytest.warning_types.PytestUnknownMarkWarning
pytester_example_dir = testing/example_scripts
markers =
issue
slow

[flake8]
Expand Down

0 comments on commit f1183c2

Please sign in to comment.