Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 12, 2023
1 parent 01aa08f commit e28bfeb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/pytest_randomly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ def pytest_collection_modifyitems(config: Config, items: list[Item]) -> None:
module_items = list(group)

for item in module_items:
marker_finder = getattr(item, "get_closest_marker", getattr(item, "get_marker", None))
marker_finder = getattr(
item, "get_closest_marker", getattr(item, "get_marker", None)
)
if not marker_finder("randomly_dont_reorganize"):
module_items = _shuffle_by_class(module_items, seed)
break
Expand Down Expand Up @@ -267,7 +269,9 @@ def _item_key(item: Item) -> bytes:
klass_items = list(group)

for item in klass_items:
marker_finder = getattr(item, "get_closest_marker", getattr(item, "get_marker", None))
marker_finder = getattr(
item, "get_closest_marker", getattr(item, "get_marker", None)
)
if not marker_finder("randomly_dont_reorganize"):
klass_items.sort(key=_item_key)
break
Expand Down
10 changes: 6 additions & 4 deletions tests/test_pytest_randomly.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,16 +594,18 @@ def test_2():
def test_3():
pass
"""
ourtester.makepyfile(test_a=code,
test_b=code,
test_c=f"""
ourtester.makepyfile(
test_a=code,
test_b=code,
test_c=f"""
import pytest
pytestmark = pytest.mark.randomly_dont_reorganize
{code}
""",
test_d=code)
test_d=code,
)
args = ["-v", "--randomly-seed=15"]

out = ourtester.runpytest(*args)
Expand Down

0 comments on commit e28bfeb

Please sign in to comment.