Creating a Distribution
Believe it or not, we are almost done with our plugin. From the command line, we can use this setup.py file to create a distribution:
| $ cd /path/to/code/ch5/pytest-nice |
| $ python setup.py sdist |
| running sdist |
| running egg_info |
| creating pytest_nice.egg-info |
| ... |
| running check |
| creating pytest-nice-0.1.0 |
| ... |
| creating dist |
| Creating tar archive |
| ... |
| $ ls dist |
| pytest-nice-0.1.0.tar.gz |
(Note that sdist stands for “source distribution.”)
Within pytest-nice, a dist directory contains a new file called pytest-nice-0.1.0.tar.gz. This file can now be used anywhere to install our plugin, even in place:
| $ pip install dist/pytest-nice-0.1.0.tar.gz |
| Processing ./dist/pytest-nice-0.1.0.tar.gz ... |
Get Python Testing with pytest now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.