From: Daniele Varrazzo Date: Sun, 23 Aug 2020 15:41:19 +0000 (+0100) Subject: Test and dev dependencies expressed as extras X-Git-Tag: 3.0.dev0~460 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ca0d0646dd4feda321a80ebcead5eaa8ae1c953;p=thirdparty%2Fpsycopg.git Test and dev dependencies expressed as extras --- diff --git a/README.rst b/README.rst index 51ca1d1e6..0e3580fa8 100644 --- a/README.rst +++ b/README.rst @@ -28,23 +28,26 @@ can install it from source using:: Hacking ------- -We assume you have built your virtualenv and ``pip`` just works and ``python`` -refers to Python 3. You can set up a dev environment with:: +You can create a local virtualenv and install there the dev and test +requirements. Feel free to adapt the following recipe if you follow a +different development pattern:: - python psycopg3/setup.py develop # for the base Python pacakge - python psycopg3_c/setup.py develop # for the C extension module + python -m venv .venv + source .venv/bin/activate + pip -e/setup.py[dev,test] develop # for the base Python pacakge + pip -e psycopg3_c/setup.py develop # for the C extension module -All the available tests and dev support are defined in the ``tox.ini`` files -in this directory and in the package directories: please refer to `tox -documentation`__ for its usage. You can run all the tests with:: +You can use tox to validate the code:: + + tox -p4 + +and to run the tests:: psql -c 'create database psycopg3_test' export PSYCOPG3_TEST_DSN="dbname=psycopg3_test" tox -c psycopg3 -s tox -c psycopg3_c -s -and validate the code before submission running:: - - tox -p4 - -.. __: https://tox.readthedocs.io/ +Please look at the commands definitions in the ``tox.ini`` files if you want +to run some of the commands interacively: the dependency should be already in +your virtualenv. diff --git a/psycopg3/setup.cfg b/psycopg3/setup.cfg index fef979d3f..9e09f6267 100644 --- a/psycopg3/setup.cfg +++ b/psycopg3/setup.cfg @@ -32,3 +32,14 @@ zip_safe = False include_package_data = True install_requires = typing_extensions + +[options.extras_require] +test = + pytest >= 6, < 6.1 + pytest-asyncio >= 0.14.0, < 0.15 + +dev = + tox + black + flake8 >= 3.8, < 3.9 + mypy >= 0.782 diff --git a/psycopg3/tox.ini b/psycopg3/tox.ini index 8ba46fefe..f5f209758 100644 --- a/psycopg3/tox.ini +++ b/psycopg3/tox.ini @@ -6,6 +6,4 @@ isolated_build = True commands = pytest ../tests {posargs} passenv = PG* PSYCOPG3_TEST_DSN PYTEST_ADDOPTS PSYCOPG3_IMPL -deps = - pytest >= 6, < 6.1 - pytest-asyncio >= 0.14.0, < 0.15 +extras = test diff --git a/psycopg3_c/tox.ini b/psycopg3_c/tox.ini index 7d7ed1624..87eec1540 100644 --- a/psycopg3_c/tox.ini +++ b/psycopg3_c/tox.ini @@ -7,6 +7,4 @@ commands = pytest ../tests {posargs} passenv = PG* PSYCOPG3_TEST_DSN PYTEST_ADDOPTS PSYCOPG3_IMPL deps = - pytest >= 6, < 6.1 - pytest-asyncio >= 0.14.0, < 0.15 - -e {toxinidir}/../psycopg3 + -e {toxinidir}/../psycopg3[test]