-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Correct unittest discovery for n-depth test source trees #2066
Conversation
if opts.tests is None: | ||
# Run everything in the test file | ||
tests = suites | ||
else: | ||
# Run a specific test class or test method | ||
for suite in suites._tests: | ||
for cls in suite._tests: | ||
for test_suite in suites._tests: |
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 my change, renaming the loop-variable from the clashing suite
to the non-clashing test_suite
. The rest of the change in this file is trailing whitespace automatically cleaned up by our extension 😄.
- we don't need to test these directly (yet)
- for file-only test select - for suite-only test select
Codecov Report
@@ Coverage Diff @@
## master #2066 +/- ##
=========================================
- Coverage 79.95% 79.85% -0.1%
=========================================
Files 307 307
Lines 14064 14064
Branches 2494 2494
=========================================
- Hits 11245 11231 -14
- Misses 2807 2821 +14
Partials 12 12
Continue to review full report at Codecov.
|
Which release will this change be in? I've been told that my issue #2660 would be fixed by this change. |
Never mind, I see this change in the |
Store full testId for files & suites during unittest discovery.
In testing the cause of the problem, I found that the testId for each test method must be prefixed by the testSuite or testFile 'nameToRun'. The testSuite/File nameToRun field was being inserted as the folderName.testClassFileName only, ignoring any further depth of the path to that testSuite/File.
Take for instance:
The testFunction would have a 'nameToRun' field generated that would be:
tests.app.suite1.test_suite1.TestSuite1.test_something
However, the testSuite would get a 'nameToRun' field generated as such:
test_suite1.TestSuite1
And the testFile would get a 'nameToRun' field generated like so:
TestSuite1.test_something
The testSuite/testFile
nameToRun
must be the exact prefix to the testFunction'snameToRun
in order for that testFunction to be selected for execution.Fixes #2044
This pull request: