Skip to content
Snippets Groups Projects

Integration testing with pytest

Installation

  1. Install Python 3.10

    Ubuntu:

    sudo add-apt-repository ppa:deadsnakes/ppa
    sudo apt install python3.10 python3.10-distutils
    curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python3.10 get-pip.py
  2. Install pipenv:

    python3.10 -m pip install pipenv==2022.4.8
  3. Install dependencies

    python3.10 -m pipenv install --deploy

Adding dependencies

python3.10 -m pipenv install <dependency-package-name>

Running

python3.10 -m pipenv run pytest
python3.10 -m pipenv run lint

or

python3.10 -m pipenv shell
# A new shell will be opened inside the pipenv environment
pytest
pipenv run lint

Running tests in parallel with pytest-xdist

python3.10 -m pipenv run pytest -n 20