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

Running a two-level package doesn't work #242

Closed
nedbat opened this issue Apr 10, 2013 · 2 comments
Closed

Running a two-level package doesn't work #242

nedbat opened this issue Apr 10, 2013 · 2 comments
Labels
bug Something isn't working run

Comments

@nedbat
Copy link
Owner

nedbat commented Apr 10, 2013

cdunklau@krusty:~/Development/coverageissue$ venv/bin/python -m salesforce_client.test_query
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
cdunklau@krusty:~/Development/coverageissue$ venv/bin/coverage run -m salesforce_client.test_query
No module named salesforce_client



cdunklau@krusty:~/Development/coverageissue$ find salesforce_client 
salesforce_client
salesforce_client/query.pyc
salesforce_client/test_query.py
salesforce_client/query.py
salesforce_client/__init__.py
salesforce_client/__init__.pyc



cdunklau@krusty:~/Development/coverageissue$ cat salesforce_client/query.py
def hello(name):
    return "hello, %s" % name
cdunklau@krusty:~/Development/coverageissue$ cat salesforce_client/test_query.py 
import unittest

from salesforce_client.query import hello

class HelloTest(unittest.TestCase):
    def test_hello(self):
        self.assertEqual(
            hello('bob'),
            'hello, bob'
        )


if __name__ == '__main__':
    unittest.main()
cdunklau@krusty:~/Development/coverageissue$ cat salesforce_client/__init__.py
cdunklau@krusty:~/Development/coverageissue$ source venv/bin/activate
(venv)cdunklau@krusty:~/Development/coverageissue$ python -m salesforce_client.test_query
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
(venv)cdunklau@krusty:~/Development/coverageissue$ coverage run -m salesforce_client.test_query
No module named salesforce_client
(venv)cdunklau@krusty:~/Development/coverageissue$ coverage debug sys
-- sys ----------------------------------------
        version: 3.6
       coverage: /home/cdunklau/Development/coverageissue/venv/local/lib/python2.7/site-packages/coverage/__init__.pyc
      cover_dir: /home/cdunklau/Development/coverageissue/venv/lib/python2.7/site-packages/coverage
     pylib_dirs: /usr/lib/python2.7
         tracer: CTracer
   config_files: .coveragerc
   configs_read: -none-
      data_path: /home/cdunklau/Development/coverageissue/.coverage
         python: 2.7.3rc2 (default, Apr 22 2012, 22:30:17) [GCC 4.6.3]
       platform: Linux-3.2.0-4-amd64-x86_64-with-debian-wheezy-sid
 implementation: CPython
     executable: /home/cdunklau/Development/coverageissue/venv/bin/python
            cwd: /home/cdunklau/Development/coverageissue
           path: /home/cdunklau/Development/coverageissue/venv/bin
                 /home/cdunklau/Development/coverageissue/venv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg
                 /home/cdunklau/Development/coverageissue/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg
                 /home/cdunklau/Development/coverageissue/venv/lib/python2.7
                 /home/cdunklau/Development/coverageissue/venv/lib/python2.7/plat-linux2
                 /home/cdunklau/Development/coverageissue/venv/lib/python2.7/lib-tk
                 /home/cdunklau/Development/coverageissue/venv/lib/python2.7/lib-old
                 /home/cdunklau/Development/coverageissue/venv/lib/python2.7/lib-dynload
                 /usr/lib/python2.7
                 /usr/lib/python2.7/plat-linux2
                 /usr/lib/python2.7/lib-tk
                 /home/cdunklau/Development/coverageissue/venv/local/lib/python2.7/site-packages
    environment: PYTHONSTARTUP = /home/cdunklau/.pythonrc

@nedbat
Copy link
Owner Author

nedbat commented Apr 10, 2013

When running "python", sys.path has an empty first element (current dir), but "coverage debug sys" shows no such entry.

@nedbat
Copy link
Owner Author

nedbat commented Apr 20, 2013

Fixed in changeset fb577266b491 (bb).

@nedbat nedbat closed this as completed Apr 20, 2013
@nedbat nedbat added major bug Something isn't working run 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 run
Projects
None yet
Development

No branches or pull requests

1 participant