Skip to content
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

ERL-97: eunit run twice tests when both module and module_tests given #3064

Closed
OTP-Maintainer opened this issue Feb 23, 2016 · 6 comments · Fixed by #6157
Closed

ERL-97: eunit run twice tests when both module and module_tests given #3064

OTP-Maintainer opened this issue Feb 23, 2016 · 6 comments · Fixed by #6157
Assignees
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community priority:low team:PS Assigned to OTP team PS

Comments

@OTP-Maintainer
Copy link

Original reporter: crownedgrouse
Affected version: Not Specified
Component: eunit
Migrated from: https://bugs.erlang.org/browse/ERL-97


Hi,
I have a module 'xxxx.erl' (no tests in it) and 3 eunit tests in 'xxxx_tests.erl' .

1> eunit:test(['xxxx_tests'],[]).
All 3 tests passed.
ok
2> eunit:test(['xxxx'],[]).
All 3 tests passed.
3> eunit:test(['xxxx_tests','xxxx'],[]).
All 6 tests passed.```

So giving 'xxxx' launch tests in 'xxxx_tests' (documentation explain this ) but giving both modules run twice the tests...

@OTP-Maintainer
Copy link
Author

crownedgrouse said:

ping ? :>)

@OTP-Maintainer
Copy link
Author

hasse said:

Hi,

I'm not sure I understand. The behaviour seems consistent:

Eshell V9.0  (abort with ^G)
1> eunit:test([eunit]).
  All 6 tests passed.
ok
2> eunit:test([eunit_tests]).
  All 6 tests passed.
ok
3> eunit:test([eunit,eunit]).
  All 12 tests passed.
ok
4> eunit:test([eunit,eunit_tests]).
  All 12 tests passed.
ok

That is, duplicates are never removed.

But I'm not very familiar with eunit, so I might have misunderstood.

Best regards

@OTP-Maintainer
Copy link
Author

crownedgrouse said:

Hi,
Issue is that same eunit test run twice. This is particularly annoying with build tools like Erlang.mk which give all modules to eunit, and it is not aware if there is tests in one,  other or both modules. This increases tests times and give a strange report to users, as double number of known tests.
Is there no way to undooblon before running tests ?

@OTP-Maintainer
Copy link
Author

crownedgrouse said:

I could undestand 
3> eunit:test([eunit,eunit]).
All 12 tests passed.

or 
3> eunit:test([eunit_tests,eunit_tests]).
All 12 tests passed.

why not, if there is any interrests to do eunit test twice (strange idea, but...).
but not 
4> eunit:test([eunit,eunit_tests]).
All 12 tests passed.

when there is only 6 tests for the module 'eunit'.
Am I clearer ?

@OTP-Maintainer
Copy link
Author

richardc said:

The idea was that you shouldn't have to list the x_tests module manually if you have a module x - then just say x and it will run any tests in x and in the corresponding x_tests module if it exists. Only if you have some y_tests module with no actual module y would you have to list y_tests explicitly. But I can see how you might want to automatically just collect a list of all module and pass the names to eunit, and then you would get duplicates. So I think filtering duplicate module names should be done, and it shouldn't be hard to add.

@OTP-Maintainer
Copy link
Author

crownedgrouse said:

I wonder however what will happen if some tests are in both module and modules_tests files, if duplicate modules are removed. This something to keep in mind.

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community team:PS Assigned to OTP team PS priority:low labels Feb 10, 2021
@bjorng bjorng linked a pull request Nov 30, 2021 that will close this issue
@u3s u3s self-assigned this Feb 15, 2022
@u3s u3s linked a pull request Sep 2, 2022 that will close this issue
@u3s u3s closed this as completed May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community priority:low team:PS Assigned to OTP team PS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants