0

I have a Django project with setup.py which looks like this:

.
├── backend
├── backoffice
├── backoffice_set
├── manage.py
├── MANIFEST.in
├── media
├── README.rst
├── requirements.txt
├── setup.py
└── venv2.7

When I run: python setup.py test everything is O.K.. However, when I run :

/opt/bin/coverage run setup.py test

The tests fail with:

writing dependency_links to cfe_backoffice.egg-info/dependency_links.txt
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'backoffice/templates/backoffice/'
writing manifest file 'cfe_backoffice.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    setup(
  File "/opt/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/opt/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/opt/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 138, in run
    self.with_project_on_sys_path(self.run_tests)
  File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 118, in with_project_on_sys_path
    func()
  File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 164, in run_tests
    testLoader = cks
  File "/opt/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/opt/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/opt/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/opt/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/opt/lib/python2.7/unittest/loader.py", line 100, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'runtests'

Has anyone seen this before? Can you suggest a solution?

1 Answer 1

1

Well, after a while I found the solution. Django was not installed globally, which is what I wanted.

I created my virtual environment with:

 virtualenv --enable-system-packages

So this lead to coverage.py not being installed inside my virtualenv. Hence the solution, which was to force pip to install it with -I, here is the full log of actions:

/opt/bin/virtualenv --system-site-packages venv2.7
. venv2.7/bin/activate
pip install -r requirements.txt 
pip install -I coverage
coverage run setup.py test
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.