From 219cbe2d9c8b243934858ec6c7b6e770d396a1f6 Mon Sep 17 00:00:00 2001 From: Eric Seppanen Date: Mon, 3 May 2021 10:48:10 -0700 Subject: [PATCH] pytest: improve documentation and protect against wrong versions It's quite hard to get python2 to exit gracefully when the code was intended for python3, because the interpreter will SyntaxError before running a single line of code. Thankfully, the pytest developers put a version check in their .ini config, so that should gracefully handle both wrong-pytest-version and wrong-python-version. Also document the woes of trying to run the pytest version shipped by e.g. Debian or Ubuntu. --- test_runner/README.md | 21 ++++++++++++++------- test_runner/pytest.ini | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 test_runner/pytest.ini diff --git a/test_runner/README.md b/test_runner/README.md index 27c7c499df..21d3ae6711 100644 --- a/test_runner/README.md +++ b/test_runner/README.md @@ -3,13 +3,20 @@ This directory contains integration tests. Prerequisites: -- pytest, psycopg2 - Install using something like this: - - `pip3 install pytest psycopg2` (Debian or Ubuntu) - -- an already compiled zenith + postgres tree - - See the root README.md for details - +- Python 3.6 or later +- Python packages: pytest, psycopg2 + - pytest 6.0 is required. + - __NOTE: `apt install` on Debian/Ubuntu won't work.__ + They ship a much older version of pytest (and sometimes rename it to + `pytest-3`.) + - Install using something like this: + - `pip3 install pytest psycopg2` (Debian or Ubuntu) +- Zenith and Postgres binaries + - See the root README.md for build directions + - Tests can be run from the git tree; or see the environment variables + below to run from other directories. +- The zenith git repo, including the postgres submodule + (for some tests, e.g. pg_regress) ### Running the tests diff --git a/test_runner/pytest.ini b/test_runner/pytest.ini new file mode 100644 index 0000000000..78b5304f78 --- /dev/null +++ b/test_runner/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +minversion = 6.0