|
4 | 4 | Good Integration Practices |
5 | 5 | ================================================= |
6 | 6 |
|
| 7 | +Install package with pip |
| 8 | +------------------------------------------------- |
| 9 | + |
| 10 | +For development, we recommend to use virtualenv_ environments and pip_ |
| 11 | +for installing your application and any dependencies |
| 12 | +as well as the ``pytest`` package itself. This ensures your code and |
| 13 | +dependencies are isolated from the system Python installation. |
| 14 | + |
| 15 | +First you need to place a ``setup.py`` file in the root of your package with the following minimum content: |
| 16 | + |
| 17 | + from setuptools import setup, find_packages |
| 18 | + |
| 19 | + |
| 20 | + setup(name="PACKAGENAME", packages=find_packages()) |
| 21 | + |
| 22 | +Where ``PACKAGENAME`` is the name of your package. You can then install your package in "editable" mode by running from the same directory:: |
| 23 | + |
| 24 | + pip install -e . |
| 25 | + |
| 26 | +which lets you change your source code (both tests and application) and rerun tests at will. |
| 27 | +This is similar to running ``python setup.py develop`` or ``conda develop`` in that it installs |
| 28 | +your package using a symlink to your development code. |
7 | 29 |
|
8 | 30 | .. _`test discovery`: |
9 | 31 | .. _`Python test discovery`: |
@@ -177,19 +199,6 @@ Note that this layout also works in conjunction with the ``src`` layout mentione |
177 | 199 | tox |
178 | 200 | ------ |
179 | 201 |
|
180 | | -For development, we recommend to use virtualenv_ environments and pip_ |
181 | | -for installing your application and any dependencies |
182 | | -as well as the ``pytest`` package itself. This ensures your code and |
183 | | -dependencies are isolated from the system Python installation. |
184 | | - |
185 | | -You can then install your package in "editable" mode:: |
186 | | - |
187 | | - pip install -e . |
188 | | - |
189 | | -which lets you change your source code (both tests and application) and rerun tests at will. |
190 | | -This is similar to running ``python setup.py develop`` or ``conda develop`` in that it installs |
191 | | -your package using a symlink to your development code. |
192 | | - |
193 | 202 | Once you are done with your work and want to make sure that your actual |
194 | 203 | package passes all tests you may want to look into `tox`_, the |
195 | 204 | virtualenv test automation tool and its `pytest support |
|
0 commit comments