Skip to content

Commit b452681

Browse files
committed
Remove unused markers and enable --strict-markers
1 parent e8218e8 commit b452681

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

testing/code/test_excinfo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import py
1212
import six
1313
from six.moves import queue
14-
from test_source import astonly
1514

1615
import _pytest
1716
import pytest
@@ -147,7 +146,6 @@ def test_traceback_entry_getsource(self):
147146
assert s.startswith("def f():")
148147
assert s.endswith("raise ValueError")
149148

150-
@astonly
151149
@failsonjython
152150
def test_traceback_entry_getsource_in_construct(self):
153151
source = _pytest._code.Source(

testing/code/test_source.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import pytest
1717
from _pytest._code import Source
1818

19-
astonly = pytest.mark.nothing
2019
failsonjython = pytest.mark.xfail("sys.platform.startswith('java')")
2120

2221

@@ -227,7 +226,6 @@ def test_getstatementrange_triple_quoted(self):
227226
s = source.getstatement(1)
228227
assert s == str(source)
229228

230-
@astonly
231229
def test_getstatementrange_within_constructs(self):
232230
source = Source(
233231
"""\
@@ -630,7 +628,6 @@ def test_multiline():
630628

631629

632630
class TestTry(object):
633-
pytestmark = astonly
634631
source = """\
635632
try:
636633
raise ValueError
@@ -675,7 +672,6 @@ def test_finally(self):
675672

676673

677674
class TestIf(object):
678-
pytestmark = astonly
679675
source = """\
680676
if 1:
681677
y = 3

testing/test_mark.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def some_function(abc):
4444
class SomeClass(object):
4545
pass
4646

47-
assert pytest.mark.fun(some_function) is some_function
48-
assert pytest.mark.fun.with_args(some_function) is not some_function
47+
assert pytest.mark.foo(some_function) is some_function
48+
assert pytest.mark.foo.with_args(some_function) is not some_function
4949

50-
assert pytest.mark.fun(SomeClass) is SomeClass
51-
assert pytest.mark.fun.with_args(SomeClass) is not SomeClass
50+
assert pytest.mark.foo(SomeClass) is SomeClass
51+
assert pytest.mark.foo.with_args(SomeClass) is not SomeClass
5252

5353
def test_pytest_mark_name_starts_with_underscore(self):
5454
mark = Mark()
@@ -936,11 +936,11 @@ class TestBarClass(BaseTests):
936936

937937
def test_addmarker_order():
938938
node = Node("Test", config=mock.Mock(), session=mock.Mock(), nodeid="Test")
939-
node.add_marker("a")
940-
node.add_marker("b")
941-
node.add_marker("c", append=False)
939+
node.add_marker("foo")
940+
node.add_marker("bar")
941+
node.add_marker("baz", append=False)
942942
extracted = [x.name for x in node.iter_markers()]
943-
assert extracted == ["c", "a", "b"]
943+
assert extracted == ["baz", "foo", "bar"]
944944

945945

946946
@pytest.mark.filterwarnings("ignore")

tox.ini

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ commands = python scripts/release.py {posargs}
141141

142142
[pytest]
143143
minversion = 2.0
144-
addopts = -ra -p pytester
144+
addopts = -ra -p pytester --strict-markers
145145
rsyncdirs = tox.ini doc src testing
146146
python_files = test_*.py *_test.py testing/*/*.py
147147
python_classes = Test Acceptance
@@ -172,6 +172,11 @@ filterwarnings =
172172
ignore::_pytest.warning_types.UnknownMarkWarning
173173
pytester_example_dir = testing/example_scripts
174174
markers =
175+
# dummy markers for testing
176+
foo
177+
bar
178+
baz
179+
# conftest.py reorders tests moving slow ones to the end of the list
175180
slow
176181

177182
[flake8]

0 commit comments

Comments
 (0)