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

I first noticed a problem with this project when I uploaded it to Jenkins. More puzzling, I was able to reproduce it as follows:

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

.venv/bin/python setup.py nosetests

Then I do the following:

  • Cloning Project: hg clone my-project my-project-clone
  • Create virtualenv .venvin clone
  • Install requirements from closed pip freeze file

If I run .venv/bin/python setup.py nosetestsin this version, and 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 am especially puzzled that each version has the same files setup.pyand setup.cfg, and as far as I can recognize, the environments are the same.

Adding

, , .

+5
2

. , . , Virtualenv Builder Jenkins:

# require nosetests be installed
# (old method using setup.py nosetests command does not work)
$VIRTUAL_ENV/bin/pip install nose

# install remain pip requirements
$VIRTUAL_ENV/bin/pip install -r requirements.pip

# must run this prior to running tests to install other nosetest dependencies
$VIRTUAL_ENV/bin/python setup.py install

# now we can run nosetests
# this does not work: $VIRTUAL_ENV/bin/python setup.py nosetests
$VIRTUAL_ENV/bin/nosetests -c setup.cfg

, Distutils Nose virtualenv. , , .

+1

All Articles