The purpose of this is to allow you to quickly get started with test driven development without getting bogged down in setting up a testing pipeile.
This uses tox to set up a full testing pipeline for the code that is installed via setup.py
which in this case is the package you can put in the app/
folder.
After you have installed tox
as per the installation steps below you just have to write your tests in tests/
and your code in app/
then run the tox
command.
Doing this will get you the following testing pipeline run:
- pylint
- mypy
- pytest
- coverage
There's some Python packages that you need to install in order to get started.
These are found in test_requirements.txt
, install with:
pip install -U pip
pip install -r test_requirements.txt
(Updating pip may not be required but is recommended)
There's a folder called app/
that contains a python package.
You can write tests for code that resides in app/
in the tests/
folder.
To run the test suite just issue the command tox
and it will then run the test suite.
Because this is structured in such a way that it installs your code as a package via setup.py
, you will need to set up any package dependencies your code has in setup.py
.
Go to setup.py
and add any packages you depend on into the list for install_requires
.
- Clone https://github.com/PythonCharmers/TDDskeleton
- Copy these files to your project folder:
- setup.py (and modify it)
- tox.ini
- Add
tox
to your project'srequirements.txt
file. - pip install -r
requirements.txt
- Change every reference to
app
insetup.py
andtox.ini
to your package name. - Update
tox.ini
to refer to the location of yourrequirements.txt
if renamed or somewhere else. - Ensure you have a
tests
folder with at least onetest_....py
file.
Now run
tox