Aquí es lo que funciona para mí:
$ virtualenv --no-site-packages env1
$ cd env1
$ source bin/activate # makes "env1" environment active,
# you will notice that the command prompt
# now has the environment name in it.
(env1)$ easy_install nose # install nose package into "env1"
he creado un paquete muy básico slither
que tenía, en su setup.py
, test_suite
mismo atributo como se ha mencionado anteriormente. Luego coloqué el origen del paquete en env1/src
.
Si se miraba en el interior env1/src
, verías:
slither/setup.py
slither/slither/__init__.py
slither/slither/impl.py # has some very silly code to be tested
slither/slither/tests.py # has test-cases
que puede ejecutar las pruebas usando test
subcomando:
(env1)$ pushd src/slither
(env1)$ python setup.py test
# ... output elided ...
test_ctor (slither.tests.SnakeTests) ... ok
test_division_by_zero (slither.tests.SnakeTests) ... ok
Ran 2 tests in 0.009s
OK
(env1)$ popd
O bien, se puede ejecutar las mismas pruebas con nosetests
:
(env1)$ pushd src
(env1)$ nosetests slither/
..
Ran 2 tests in 0.007s
OK
(env1)$ popd
También tenga en cuenta que nosetests
c un ser exigente con los ejecutables. Puede pasar --exe
si desea que descubra pruebas en módulos de Python que sean ejecutables.
En una nota relacionada, la nariz funciona bien "de fábrica" en una computadora diferente ... así que hay algo raro con el sistema que estaba teniendo problemas. – Ryan