You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support PEP420 (implicit namespace packages) as --pyargs target. (#13426)
Previously, when running `--pyargs pkg`, if you didn't have `pkg/__init__.py`, pytest would fail with `ERROR: module or package not found: pkg (missing __init__.py?)`.
If used in conjunction with `consider_namespace_packages` in config, pytest discovers the package and tests inside it correctly.
If used in conjunction with `consider_namespace_packages` in config, test
modules get correct `__package__` and `__name__` attributes as well.
In addition, remove `"namespace"` origin handling -- this value isn't used since python 3.8.
See:
- python/cpython#5481
- https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec.submodule_search_locationsFixes#478Fixes#2371Fixes#10569
Copy file name to clipboardExpand all lines: doc/en/reference/reference.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1384,6 +1384,7 @@ passed multiple times. The expected format is ``name=value``. For example::
1384
1384
when collecting Python modules. Default is ``False``.
1385
1385
1386
1386
Set to ``True`` if the package you are testing is part of a namespace package.
1387
+
Namespace packages are also supported as ``--pyargs`` target.
1387
1388
1388
1389
Only `native namespace packages <https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#native-namespace-packages>`__
1389
1390
are supported, with no plans to support `legacy namespace packages <https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#legacy-namespace-packages>`__.
0 commit comments