6. Test Package#
You can test the package using either pytest or tox.
6.1. Test with pytest
#
The package can be tested by running several test scripts, which test all sub-packages and examples.
Clone the source code from the repository and install the required test packages by
git clone https://github.com/ameli/glearn.git
cd glearn
python -m pip install -r tests/requirements.txt
python -m pip install .
To automatically run all tests, use pytest
which is installed by the above commands.
mv glearn glearn-do-not-import
pytest
Attention
To properly run pytest
, rename /glearn/glearn
directory as shown in the above code. This makes pytest
to properly import g-learn from the installed location, not from the source code directory.
6.2. Test with tox
#
To run a test in a virtual environment, use tox
as follows:
Clone the source code from the repository:
git clone https://github.com/ameli/glearn.git
Install tox:
python -m pip install tox
Run tests by
cd glearn tox