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
Implicit namespaces support #165
Conversation
This specific part of this doctest was hanging wit the implicit namespace support. Handling `sdtin` as with the other parts of this doctest makes it at least not hang.
Seems that this file was irrelevant for the test suite, and only when the implicit namespace support was added, the file was found and was breaking the test suite.
7a5a7f7
to
fff59d4
Compare
Status update: all tests pass and the only two adjustments on the tests seem to be fine enough. I could move those tests adjustments to a separate PR to validate that, indeed, they are not needed for this PR to pass, but stand on their own. |
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.
The only side effect is, it may take longer to discover tests, right? But I think this is fine. If someone complains, testrunner can be configured to search more specific.
What do you mean by "test suite needs to be adjusted"? Do you mean existing packages need their tests changed? |
Since it did not traverse into non- |
@dataflake sorry, that was an interim comment, when I first pushed this PR, I knew that the code was working, as I used the I was expecting more breakage, but turned out not to be 👍🏾 Regarding test discovery, I see a problem, like we faced in Basically, ignore folders with leading dots, |
It looks like the current code here only omits leading dot folders with the regular expression
This expression is used to filter out folders while walking the tree: zope.testrunner/src/zope/testrunner/find.py Line 301 in a68a866
I suggest adding at least |
I'm not sure what would be the simplest way to implement this, but it would be nice if the test discovery skipped any paths that are matched by |
There is https://github.com/thehanimo/py-gitignore under MIT license which seems to be capable of checking whether a path is ignored via |
Michael Howitz wrote at 2024-2-20 23:24 -0800:
> I'm not sure what would be the simplest way to implement this, but it would be nice if the test discovery skipped any paths that are matched by `.gitignore` configuration.
There is https://github.com/thehanimo/py-gitignore under MIT license which seems to be capable of checking whether a path is ignored via `.gitignore`.
Not sure whether depending on `.gitignore` is a good approach:
it would mean that test runs behave differently between
run from a git checkout (with .gitignore) and from e.g. an
installation (without ".gitignore")
(and maybe even a source distribution).
When I have understood this correctly, we run tests
not from a git checkout but from a wheel for some projects.
|
I agree with Dieter and I don't think there's much gain for the price of yet another dependency or manually written code that needs maintaining going forward. My suggestion still stands, expand the current exclusion of dot folders by adding |
@d-maurer Good point, I agree that's a compelling reason to not use |
I adjusted the code just slightly to ignore well known folders we want to skip. I added some minimal tests to ensure we know what we are accepting/rejecting right now. 🍀 |
97318da
to
4a41c25
Compare
As an idea for a future iteration as a new PR (to get this one here merged soon): Get the |
@jensens yes, I thought about that as well, that one way or another users could provide their own list of ignored folders 👍🏾 But yes, let's merge this, a new release, and see how much it breaks 🍀 😅 |
Release 6.4 is now published |
Closes #160
Allow
zope.testrunner
to find tests suites for packages that follow the PEP 420 implicit namespaces.Note that this works on test packages, like zopefoundation/megrok.strictrequire#8
Test suite needs to be adjusted, but at least we have a reference implementation that seems to be working for packages already using implicit namespaces.
To test it with
megrok.strictrequire
:Most of the test failures of
zope.testrunner
's own test suite is due to, probably, the test runner finding too much tests. I will dig into it later, but I wanted to post the PR as soon as it was minimally working ✨