Skip to content

Commit e199488

Browse files
committed
Fix handling of unregistered ini value
- make sure no plugins have to installed to read the settings
1 parent eebfcf6 commit e199488

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

pytest_order/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ def __init__(self, config: Config) -> None:
5454
if self.group_scope.value > self.scope.value:
5555
warn("Group scope is larger than order scope, ignoring it.")
5656
self.group_scope = self.scope
57-
auto_mark_dep = config.getini("automark_dependency")
57+
try:
58+
auto_mark_dep = config.getini("automark_dependency")
59+
except ValueError:
60+
auto_mark_dep = False
5861
self.auto_mark_dep = (
5962
auto_mark_dep
6063
and auto_mark_dep.lower() in ("1", "yes", "y", "true", "t", "on")

tests/test_misc.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,25 @@ def test_markers_registered(capsys):
2424
assert "@pytest.mark.order" in out
2525
# only order is supported as marker
2626
assert out.count("Provided by pytest-order.") == 1
27+
28+
29+
def tests_working_without_dependency(test_path):
30+
"""Make sure no other plugins are needed in settings."""
31+
test_path.makepyfile(
32+
test_a=(
33+
"""
34+
import pytest
35+
36+
def test_a(): pass
37+
38+
@pytest.mark.order(0)
39+
def test_b(): pass
40+
"""
41+
)
42+
)
43+
result = test_path.runpytest("-v", "-p", "no:xdist",
44+
"-p", "no:dependency", "-p", "no:mock")
45+
result.stdout.fnmatch_lines([
46+
"test_a.py::test_b PASSED",
47+
"test_a.py::test_a PASSED",
48+
])

0 commit comments

Comments
 (0)