I try to use nosetests
❯ nosetests '/pathTo/test'
but it uses python 2.7
for my tests:
sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0)
So some of them fails, because they were written in python 3.3
.
I work it around and installed virtual environment:
pyvenv-3.3 py3env
Activated it:
source ~/py3env/bin/activate
Check python virsion in virtual environment:
❯ python --version ⏎ Python 3.3.3 (py3env)
Ok. But nosetest still uses python2.7
even in virtual environment:
sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0)
So my tests fails. How to make nose use python3?
Basic Usage nose can be integrated with DocTest by using with-doctest option in athe bove command line. The result will be true if the test run is successful, or false if it fails or raises an uncaught exception. nose supports fixtures (setup and teardown methods) at the package, module, class, and test level.
Nose is a popular test automation framework in Python that extends unittest to make testing easier. The other advantages of using the Nose framework are the enablement of auto discovery of test cases and documentation collection.
django-nose provides all the goodness of nose in your Django tests, like: Testing just your apps by default, not all the standard ones that happen to be in INSTALLED_APPS. Running the tests in one or more specific modules (or apps, or classes, or folders, or just running a specific test)
In Python 3.4
and higher versions: in order to make nose use python3
just run ...
python3 -m "nose"
... in the target directory with the tests.
The environment setups are not required.
To install:
sudo apt-get install python-nose python3-nose
To run:
nosetests-2.7 ; nosetests3
This runs the test suite under both PY2 and PY3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With