Testing¶
For a fast test run using the available python, use pytest:
$ pytest tests
The test suite uses the following environment variables to connect to the database:
POSTGRES_DB(defaultpgcopy_test)POSTGRES_HOSTPOSTGRES_PORT(default5432)POSTGRES_USERPOSTGRES_PASSWORD
One of psycopg2 or psycopg is required to run the tests. The test suite will automatically discover all supported db adaptors.
For more thorough testing, tox with tox-docker will run tests on python versions 3.9 – 3.14 and postgresql versions 13 – 18:
$ tox
Additionally, the test suite can be run with no local requirements other than the ubiquitous docker:
$ docker-compose up pgcopy
The pgcopy test suite can also be run against AWS Aurora DSQL. For this,
boto3 must be installed and POSTGRES_HOST set to the dsql endpoint.
Note
Tests for extension types will be skipped if the required db extension is not available.