Skip to content

Fix mix test --only async:true/false #13639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

SteffenDE
Copy link
Contributor

@SteffenDE SteffenDE commented Jun 5, 2024

This got accidentally broken in #13618.

@josevalim

@@ -624,6 +624,7 @@ defmodule ExUnit.Case do

moduletag = Module.get_attribute(mod, :moduletag)
tag = Module.delete_attribute(mod, :tag)
{async, _parameterize} = Module.get_attribute(mod, :ex_unit_module)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of reading it here, maybe we can make it part of moduletag and that will just work? Then I think we can also remove it from __before_compile__ too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to set it inside ExUnit.Runner in run_module/prepare_tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We validate that the module tags don't set any reserved tags. Async is in the list of reserved tags. If we remove it there and do a Module.put_attribute(module, :moduletag, [async: async?]) in __register__ it would work, but then users can also do

defmodule MyTest do
  use ExUnit.Case

  @moduletag async: true
end

I don't know if that's fine. The current change is basically how it was previously and I'm really no expert on ExUnit internals :)

@josevalim josevalim closed this in ecac839 Jun 9, 2024
@SteffenDE
Copy link
Contributor Author

@josevalim should I send a separate PR for the tests I added here? Or do you think they‘re not really needed?

@josevalim
Copy link
Member

@SteffenDE I am usually against fixtures, because they are expensive, but I tried to port your test to be fixture-less on the mix suite and failed. The thing I want to try next is to add test to test/ex_unit_test.exs, I think it is more doable, but I probably have time only after thursday. So if you want to give it a try and send a PR, i will gladly merge it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants