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

No Python source warning for namespace modules #572

Closed
nedbat opened this issue Apr 6, 2017 · 4 comments
Closed

No Python source warning for namespace modules #572

nedbat opened this issue Apr 6, 2017 · 4 comments
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Apr 6, 2017

Originally reported by Christian Heimes (Bitbucket: tiran, GitHub: tiran)


setuptools no longer installs a __init__.py for namespace packages. Now I'm getting a warning Coverage.py warning: Module custudia has no Python source. for a namespace package called custodia. You can easily reproduce the issue with a git checkout of https://github.com/latchset/custodia:

Reproducer:

$ git clone https://github.com/latchset/custodia.git
$ cd custodia
$ tox -e py27
...
=================================================================================== 101 passed in 11.23 seconds ====================================================================================
Coverage.py warning: Module custodia has no Python source.
_____________________________________________________________________________________________ summary ______________________________________________________________________________________________
  py27: commands succeeded
  congratulations :)

On both Python 2 and 3, a namespace module has a __path__ attribute but no __file__ attribute. May I suggest that you omit the warning when a module has no __file__ but a __path__?

$ cd /tmp
$ mkdir nsexample
$ touch nsexample/module.py
$ python3
>>> import nsexample
>>> import nsexample.module
>>> dir(nsexample)
['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'module']
>>> dir(nsexample.module)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']


@nedbat
Copy link
Owner Author

nedbat commented Apr 7, 2017

When I try the custodia example, I get different output, without that warning. Can you provide a runnable example that produces that exact warning?

@nedbat
Copy link
Owner Author

nedbat commented May 2, 2017

Original comment by Christian Heimes (Bitbucket: tiran, GitHub: tiran)


Here is a travis job with a reproducer: https://travis-ci.org/tiran/custodia/jobs/227995541

@nedbat
Copy link
Owner Author

nedbat commented May 2, 2017

Original comment by Christian Heimes (Bitbucket: tiran, GitHub: tiran)


https://github.com/tiran/covns is a minimal reproducer for the problem

GLOB sdist-make: .../covns/setup.py
py27 inst-nodeps: .../covns/.tox/dist/covns-0.1.zip
py27 installed: appdirs==1.4.3,coverage==4.3.4,covns==0.1,packaging==16.8,py==1.4.33,pyparsing==2.2.0,pytest==3.0.7,six==1.10.0
py27 runtests: PYTHONHASHSEED='388494413'
py27 runtests: commands[0] | .../covns/.tox/py27/bin/python -m coverage run --parallel -m pytest --capture=no --strict
=============================================================== test session starts ===============================================================
platform linux2 -- Python 2.7.13, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: .../covns, inifile: tox.ini
collected 1 items 

tests.py .

============================================================ 1 passed in 0.02 seconds =============================================================
Coverage.py warning: Module covns has no Python source.
_____________________________________________________________________ summary _____________________________________________________________________
  py27: commands succeeded
  congratulations :)

@nedbat
Copy link
Owner Author

nedbat commented May 5, 2017

Fixed in 66dd7fd60798 (bb).

@nedbat nedbat closed this as completed May 5, 2017
@nedbat nedbat added minor bug Something isn't working labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant