diff --git a/docs/contributing.rst b/docs/contributing.rst index a6157866..17320d4d 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -154,7 +154,7 @@ coverage measurements (using pytest-cov plugin) are not reliable. If you want to measure coverage you'll need to create .pth file as described in `subprocess section of coverage documentation`_. If you're using -``setup.py develop`` you should uninstall pytest_django (using pip) +editable mode you should uninstall pytest_django (using pip) for the time of measuring coverage. You'll also need mysql and postgres databases. There are predefined settings diff --git a/docs/database.rst b/docs/database.rst index 7d220eab..72efe95d 100644 --- a/docs/database.rst +++ b/docs/database.rst @@ -132,7 +132,7 @@ A good way to use ``--reuse-db`` and ``--create-db`` can be: Using ``--no-migrations`` (alias: ``--nomigrations``) will disable Django migrations and create the database by inspecting all models. It may be faster when there are several migrations to run in the database setup. You can use ``--migrations`` to force running -migrations in case ``--no-migrations`` is used, e.g. in ``setup.cfg``. +migrations in case ``--no-migrations`` is used, e.g. in ``pyproject.toml``. .. _advanced-database-configuration: diff --git a/docs/managing_python_path.rst b/docs/managing_python_path.rst index cc7731d1..37488662 100644 --- a/docs/managing_python_path.rst +++ b/docs/managing_python_path.rst @@ -19,9 +19,9 @@ looking for the project's ``manage.py`` file and adding its directory to the Python path. Looking for the ``manage.py`` file uses the same algorithm as pytest uses to -find ``pytest.ini``, ``tox.ini`` and ``setup.cfg``: Each test root directories -parents will be searched for ``manage.py`` files, and it will stop when the -first file is found. +find ``pyproject.toml``, ``pytest.ini``, ``tox.ini`` and ``setup.cfg``: Each +test root directories parents will be searched for ``manage.py`` files, and it +will stop when the first file is found. If you have a custom project setup, have none or multiple ``manage.py`` files in your project, the automatic detection may not be correct. See @@ -47,16 +47,19 @@ Managing your project with virtualenv, pip and editable mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The easiest way to have your code available on the Python path when using -virtualenv and pip is to have a setup.py file and install your project in -editable mode when developing. +virtualenv and pip is to install your project in editable mode when developing. -If you don't already have a setup.py file, creating a setup.py file with this -content will get you started:: +If you don't already have a pyproject.toml file, creating a pyproject.toml file +with this content will get you started:: - import setuptools - setuptools.setup(name='myproj', version='1.0') + # pyproject.toml + [build-system] + requires = [ + "setuptools>=61.0.0", + ] + build-backend = "setuptools.build_meta" -This ``setup.py`` file is not sufficient to distribute your package to PyPI or +This ``pyproject.toml`` file is not sufficient to distribute your package to PyPI or more general packaging, but it should help you get started. Please refer to the `Python Packaging User Guide `_ @@ -71,7 +74,7 @@ add this directly to your project's requirements.txt file like this:: # requirements.txt -e . - django>=1.11 + django pytest-django @@ -80,8 +83,6 @@ Using pytest's ``pythonpath`` option You can explicitly add paths to the Python search path using pytest's :pytest-confval:`pythonpath` option. -This option is available since pytest 7; for older versions you can use the -`pytest-pythonpath `_ plugin. Example: project with src layout ```````````````````````````````` diff --git a/tests/test_django_settings_module.py b/tests/test_django_settings_module.py index 2312fa14..76e93407 100644 --- a/tests/test_django_settings_module.py +++ b/tests/test_django_settings_module.py @@ -1,6 +1,6 @@ """Tests which check the various ways you can set DJANGO_SETTINGS_MODULE -If these tests fail you probably forgot to run "python setup.py develop". +If these tests fail you probably forgot to run "pip install -e .". """ import pytest