Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ UNRELEASED
++++++++++

* Dropped support for Python 3.9 and 3.10 (Python 3.11+ is now required) and added support for Python 3.14 and 3.15.
* Fix `#41 <https://github.com/pytest-dev/pytest-random-order/issues/41>`_ and `#53 <https://github.com/pytest-dev/pytest-random-order/issues/53>`_: ``--failed-first`` no longer crashes with ``NotImplementedError`` when the last run had a collection error or failures in nested classes.

1.2.0
+++++
Expand Down
11 changes: 0 additions & 11 deletions random_order/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@ def process_failed_first_last_failed(session, config, items):
if not last_failed_raw:
return

# Get the names of last failed tests
last_failed = []
for key in last_failed_raw:
parts = key.split("::")
if len(parts) == 3:
last_failed.append(tuple(parts))
elif len(parts) == 2:
last_failed.append((parts[0], None, parts[1]))
else:
raise NotImplementedError()

def assign_last_failed_to_same_bucket(item, key):
if item.nodeid in last_failed_raw:
return FAILED_FIRST_LAST_FAILED_BUCKET_KEY
Expand Down
19 changes: 19 additions & 0 deletions tests/test_actual_test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,22 @@ def test_failed_first(tmp_tree_of_tests, get_test_calls, bucket):
calls2 = get_test_calls(result2)
first_three_tests = {c.name for c in calls2[:3]}
assert {"test_a1", "test_b2", "test_ee2"} == first_three_tests


def test_failed_first_after_collection_error_and_nested_class(testdir):
testdir.makepyfile(
test_broken="import does_not_exist",
test_nested=textwrap.dedent("""
class TestOuter:
class TestInner:
def test_fail(self):
assert False

def test_pass():
pass
"""),
)
testdir.runpytest("--continue-on-collection-errors").assert_outcomes(passed=1, failed=1, errors=1)

result = testdir.runpytest("--continue-on-collection-errors", "--failed-first")
result.assert_outcomes(passed=1, failed=1, errors=1)