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

Support implicit namespaces (PEP 420) #160

Closed
icemac opened this issue Jan 25, 2024 · 4 comments · Fixed by #165
Closed

Support implicit namespaces (PEP 420) #160

icemac opened this issue Jan 25, 2024 · 4 comments · Fixed by #165

Comments

@icemac
Copy link
Member

icemac commented Jan 25, 2024

FEATURE REQUEST

What I did:

Converted megrok.strictrequire to a package using a PEP 420 implicit namespace.
See zopefoundation/megrok.strictrequire#8

What I expect to happen:

Tests run like before.

What actually happened:

No tests were run because directories without an __init__.py are not considered to contain Python code.
See

if dirname != p and not contains_init_py(options, files):
# This is not a plausible test directory. Avoid descending
# further.
del dirs[:]
continue

What version of Python and Zope/Addons I am using:

  • OS independent
  • Python 3.7+

⚠️ This feature is required to solve zopefoundation/meta#194

@dataflake
Copy link
Member

Not sure if it helps, but if you invoke the test runner and pass a specific package name, like megrok.strictrequire, the test search will not start in src, but in src/megrok/strictrequire and circumvent the issue. The tests are found and run.

zope-testrunner --test-path=src --package megrok.strictrequire

@icemac
Copy link
Member Author

icemac commented Jan 26, 2024

@dataflake That's an interesting workaround for running the tests of a single package. The question would be if this could also work when testing an application having multiple packages.

@dataflake
Copy link
Member

The package argument can be passed multiple times.

@jensens
Copy link
Member

jensens commented Jan 26, 2024

I stumbled over this too some weeks ago and switched to pytest in my project, forgot to create an issue here... Sorry.

@icemac icemac changed the title Support implicit namespaces Support implicit namespaces (PEP 420) Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants