@@ -19,9 +19,9 @@ looking for the project's ``manage.py`` file and adding its directory to the
19
19
Python path.
20
20
21
21
Looking for the ``manage.py `` file uses the same algorithm as pytest uses to
22
- find ``pytest.ini ``, ``tox.ini `` and ``setup.cfg ``: Each test root directories
23
- parents will be searched for ``manage.py `` files, and it will stop when the
24
- first file is found.
22
+ find ``pyproject.toml ``, `` pytest.ini ``, ``tox.ini `` and ``setup.cfg ``: Each
23
+ test root directories parents will be searched for ``manage.py `` files, and it
24
+ will stop when the first file is found.
25
25
26
26
If you have a custom project setup, have none or multiple ``manage.py `` files
27
27
in your project, the automatic detection may not be correct. See
@@ -47,16 +47,19 @@ Managing your project with virtualenv, pip and editable mode
47
47
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
48
49
49
The easiest way to have your code available on the Python path when using
50
- virtualenv and pip is to have a setup.py file and install your project in
51
- editable mode when developing.
50
+ virtualenv and pip is to install your project in editable mode when developing.
52
51
53
- If you don't already have a setup.py file, creating a setup.py file with this
54
- content will get you started::
52
+ If you don't already have a pyproject.toml file, creating a pyproject.toml file
53
+ with this content will get you started::
55
54
56
- import setuptools
57
- setuptools.setup(name='myproj', version='1.0')
55
+ # pyproject.toml
56
+ [build-system]
57
+ requires = [
58
+ "setuptools>=61.0.0",
59
+ ]
60
+ build-backend = "setuptools.build_meta"
58
61
59
- This ``setup.py `` file is not sufficient to distribute your package to PyPI or
62
+ This ``pyproject.toml `` file is not sufficient to distribute your package to PyPI or
60
63
more general packaging, but it should help you get started. Please refer to the
61
64
`Python Packaging User Guide
62
65
<https://python-packaging-user-guide.readthedocs.io/en/latest/tutorial.html#creating-your-own-project> `_
@@ -71,7 +74,7 @@ add this directly to your project's requirements.txt file like this::
71
74
72
75
# requirements.txt
73
76
-e .
74
- django>=1.11
77
+ django
75
78
pytest-django
76
79
77
80
@@ -80,8 +83,6 @@ Using pytest's ``pythonpath`` option
80
83
81
84
You can explicitly add paths to the Python search path using pytest's
82
85
:pytest-confval: `pythonpath ` option.
83
- This option is available since pytest 7; for older versions you can use the
84
- `pytest-pythonpath <https://pypi.python.org/pypi/pytest-pythonpath >`_ plugin.
85
86
86
87
Example: project with src layout
87
88
````````````````````````````````
0 commit comments