QPID-8170: fix qpid-python-test discovery broken by commit 85348b01#18
Merged
jiridanek merged 1 commit intoapache:mainfrom Apr 12, 2023
Merged
Conversation
The problem stems from the way the testcode imports the production code, so that when both have a module of the same name, the test runner descends into the production code when discovering tests, instead of into the test code.
```
{code:title=qpid/tests/messaging/__init__.py}
from qpid.tests.messaging.implementation import *
[...]
from . import address, endpoints, message, selector
{code}
The file imported on the first line contains
{code:title=qpid/tests/messaging/implementation.py}
from qpid.messaging import *
{code}
```
and {{qpid.messaging}} contains its own {{address.py}} submodule.
Therefore, when {{qpid-test-runner}} tries to access {{qpid.tests.messaging.mesage}}, it actually gets {{qpid.messaging.message}}, which was imported first. But that does not contain any tests, and the message tests are missed and never executed.
This only started happening after my relative imports modernizing commit apache@9651001.
Before, Totals: 349 tests, 349 passed, 0 skipped, 0 ignored, 0 failed and Totals: 678 tests, 585 passed, 93 skipped, 0 ignored, 0 failed (https://github.com/apache/qpid-python/actions/runs/4661323947/jobs/8250463871)
After, Totals: 218 tests, 218 passed, 0 skipped, 0 ignored, 0 failed and Totals: 547 tests, 454 passed, 93 skipped, 0 ignored, 0 failed (https://github.com/apache/qpid-python/actions/runs/4661535006/jobs/8250915935)
Contributor
Author
So the total test count is correct, albeit the second command runs less tests because it now does not run again what was run in the first command. All tests accounted for. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem stems from the way the testcode imports the production code, so that when both have a module of the same name, the test runner descends into the production code when discovering tests, instead of into the test code.
and {{qpid.messaging}} contains its own {{address.py}} submodule.
Therefore, when {{qpid-test-runner}} tries to access {{qpid.tests.messaging.mesage}}, it actually gets {{qpid.messaging.message}}, which was imported first. But that does not contain any tests, and the message tests are missed and never executed.
This only started happening after my relative imports modernizing commit 9651001.
Before, Totals: 349 tests, 349 passed, 0 skipped, 0 ignored, 0 failed and Totals: 678 tests, 585 passed, 93 skipped, 0 ignored, 0 failed (https://github.com/apache/qpid-python/actions/runs/4661323947/jobs/8250463871)
After, Totals: 218 tests, 218 passed, 0 skipped, 0 ignored, 0 failed and Totals: 547 tests, 454 passed, 93 skipped, 0 ignored, 0 failed (https://github.com/apache/qpid-python/actions/runs/4661535006/jobs/8250915935)