Skip to content

failing parameterized tests may not be retried by mix test --failed #15820

Description

@PragTob

Existing issue

  • I have searched existing issues and could not find a duplicate.

Elixir and Erlang/OTP versions

Erlang/OTP 28 [erts-16.4.0.4] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.20.4 (compiled with Erlang/OTP 28)

Operating system

Mac and linux

Current behavior

Here is the repro repo: https://github.com/PragTob/test_partition_failed

Basically given this test file that deliberately fails the first parameterized test:

defmodule ParamProbeTest do
  use ExUnit.Case,
    parameterize: [%{serializer: :a}, %{serializer: :b}]

  test "checks serializer", %{serializer: serializer} do
    assert serializer == :b
  end
end

The test fails, but isn't retried (as the manifest doesn't seem to respect the parameters), as signified by "there are no tests to run":

➜  test_partition_failed git:(main) ✗ mix test
Running ExUnit with seed: 542624, max_cases: 20
  1) test checks serializer (ParamProbeTest)
     Parameters: %{serializer: :a}
     test/parameterized_test.exs:5
     Assertion with == failed
     code:  assert serializer == :b
     left:  :a
     right: :b
     stacktrace:
       test/parameterized_test.exs:6: (test)

...
Finished in 0.01 seconds (0.00s async, 0.01s sync)

Result: 3/4 passed (1/1 doctest, 2/3 tests)
Failed: 1 test
➜  test_partition_failed git:(main) ✗ mix test --failed
There are no tests to run

Expected behavior

I'd expect the manifest/mix test --failed to respect the parameterized tests and retry them accordingly :)

So, I think I know where this hails from and am more than happy to submit a PR/patch. Probably won't be able to make it today though so maybe tomorrow.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions