/python-testing

Provides a platform for demonstrating basic algorithm design using test-driven development.

Primary LanguageMakefile

Python Testing

Provides a platform for demonstrating basic algorithm design using test-driven development.

Usage

Install Docker Desktop and git.

Clone the repository:

git clone https://github.com/joshvillbrandt/python-testing.git
cd python-testing

Build the docker image:

make build

And finally run the tests:

make test

There are also lint and shell targets available in the makefile.

Tips

Unit tests can be run with the make test command. Coverage and JunitXML outputs are automatically provided in the .results folder.

Single test methods can be executed by invoking the pytest command directly:

docker-compose run api pytest tests/file.py::function

or just like this if already in a shell:

pytest tests/file.py::function

Additionally, it is frequently useful to add the --pdb argument so that the test runner dumps you into the python debugger if there is an error.

For more information see the pytest docs.