Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get the error "Invalid command nosetests" when I run nosetests from my virtualenv?

I first noticed the problem with this project when I loaded it into Jenkins. More puzzlingly, I've been able to reproduce it as follows:

In original version of the project, the following command runs tests as expected:

.venv/bin/python setup.py nosetests

I then do the following:

  1. Clone project: hg clone my-project my-project-clone
  2. Create virtualenv .venv in clone
  3. Install requirements from cloned pip freeze file

If I then run .venv/bin/python setup.py nosetests on this version and I get the following result:

setup.py: error: Invalid command nosetests

setup.py includes the following settings:

setup_requires=[
    'nose>=1.0', 'nosexcover', 'coverage', 'selenium', 'fixture'
],
test_suite='nose.collector',

I'm especially baffled because it's the same setup.py and setup.cfg files in each version and, as far as I been able to discern, the environments are identical.

Addendum

I noticed this Stack Overflow question in the sidebar, which looks closely related, but none of the solutions offered there are working in my case.

like image 202
klenwell Avatar asked Oct 21 '22 16:10

klenwell


1 Answers

I ran into the same problem and managed to fix it by putting

setup_requires=['nose>=1.0']

Into my setup.py file. After that the Python setup.py nosetests option was available to me.

Some links that were helpful:

  • https://nose.readthedocs.org/en/latest/setuptools_integration.html
  • https://nose.readthedocs.org/en/latest/api/commands.html
like image 197
user2411718 Avatar answered Oct 24 '22 09:10

user2411718