Testing

After you’ve set up your environment, you can run tests on available Python interpreters:

nox -rs tests

Integration tests

To run integration tests, the Docker daemon must be running and the Docker CLI must be available.

nox -rs integration

You can customize the following settings:

pytest option

Environment variable

Description

--limesurvey-database-type

LS_DATABASE_TYPE

Database used for integration tests

--limesurvey-image-tag

LS_IMAGE_TAG

Docker image tag for integration tests

--limesurvey-username

LS_USER

Username of the LimeSurvey user to test against

--limesurvey-password

LS_PASSWORD

Password of the LimeSurvey user to test against

--limesurvey-password

LS_PASSWORD

Password of the LimeSurvey user to test against

--limesurvey-git-reference

LS_REF

Reference to a specific LimeSurvey commit

--limesurvey-docker-context

LS_DOCKER_CONTEXT

Path to the directory containing the Dockerfile

The easiest way to set these is to create a .env file in the root of the repository.

For example, to test against the 6.6.4-240923-apache image with a MySQL database:

LS_DATABASE_TYPE=mysql
LS_IMAGE_TAG=6.6.4-240923-apache

Or to test against the master branch:

LS_REF=refs/heads/master

Or to test against a specific commit (e.g. f148781ec57fd1a02e5faa26a7465d78c9ab5dfe):

such a version in CI, add the following to the test matrix in the integration job:

LS_REF=f148781ec57fd1a02e5faa26a7465d78c9ab5dfe

Coverage

I strive to maintain 100% combined coverage (from multiple Python versions, as well as integration tests), so make sure your changes are tested..

Other tests

Doctests

nox -rs xdoctest

Type checking

nox -rs mypy

Dependency checks

nox -rs deps