-
Notifications
You must be signed in to change notification settings - Fork 108
Allow selective testing of single suites and tests #177
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very useful addition, thanks! I see no problems with the implementation. 👍
Thanks, @awvwgk. I have a few questions.
or does this work:
If not, any way we can make it work without quotes? As is, the CLI UI seems a bit awkward to me.
This way we drop the |
Regarding the first point, for a single argument it will work without quotes just fine. The reason for the quotation marks is mainly due to the limitation of the bootstrap fpm implementation, see #138. Therefore, I just put them around the arguments every time while testing (and writing the PR up). Regarding your suggestion at the second point, I guess there is some mix-up between the testing framework in fpm and the fpm-test target. Since we are building and testing fpm with fpm, this requires careful reading and writing, I hope I got the latter right.
The best solution would be to allow the |
Okay, if I understood this correctly, I confused fpm's internal test suites with test targets that any fpm package can have. In that case, I'm happy with this moving forward as is. |
This is a small and low impact PR with no objections so I'll go ahead and merge it. Thank you, @awvwgk! |
Related to #176.
In case we want to continue using the current unit testing framework, this PR should reduce the boilerplate code to register new test suites and allow for some better debugging of failing tests.
Registering a new test suite works now in a similar way as registering a unit test in the collecting interface:
fpm/fpm/test/main.f90
Lines 15 to 19 in 4a5ecae
The other point is handling and debugging of failing tests.
Running
fpm test
will run all test suites and all contained unit tests. In case we encounter a failure, we usually don't want to run all tests every time while debugging, therefore I added the option to select the test suite and the test we want to run.The available levels of testing are than:
fpm test
: no argument will run all available test suitesfpm test --args "help"
or any other not available test suite will print the names of all available test suites (will not run any tests and exit code will be 1)fpm test --args "fpm_source_parsing"
will select the source parsing test suite and only run its unit testsfpm test --args "fpm_source_parsing help"
or any other not available unit test will print the names of all available unit tests in the test suite source parsing (will not run any tests and exit code will be 1)fpm test --args "fpm_source_parsing invalid-submodule"
will only run the invalid-submodule unit test from the source parsing test suite