at first place, you write you test code and some test support libraries, push them to the git repository.
but, some days later, you may be thinking why don't I pack them to a distribution , upload to a private PyPi site, so every one can download your test support libraries and testcases by pip install xxx command.
before you share your codes as a distribution which can be installed by pip, you will think I need test them.
So, you need put your test code in the directory, then you need a convenient way to run them, for example, run test cases in the directory.
so, the commands is following:
put a setup.py in your source codes directory
setup.py used by packing tools
before you pack your code to distribution file , you want to test them
with pytest-runner, you can just type the following command to run test
python setup.py pytest
you get your test report, everything is ok, you need pack them up
python setup.py sdist
you will have a .tar.gz file in your dist sub dir
4.you upload it to PyPi.org(of course ,you need register a account)
python setup.py upload dist/xxxx.tar.gz
then, everyone can use your code by
pip install
more than that, you can configure setup.py file ,give your code a executable entry point, so that you can run your test directly by command after installing your distribution