Skip to content
Snippets Groups Projects
  • Yaroslav Dynnikov's avatar
    1bfc5a21
    test: revise pytest environment · 1bfc5a21
    Yaroslav Dynnikov authored
    1. Review `Pipfile`:
      - Remove unused `filelock`;
      - Install `mypy` - static type checker for Python.
    2. Add new command `pipenv run lint`.
    3. Enable `mypy` in CI. Fix reported errors in `test_basics.py`.
    4. Renew readme.
    Verified
    1bfc5a21
    History
    test: revise pytest environment
    Yaroslav Dynnikov authored
    1. Review `Pipfile`:
      - Remove unused `filelock`;
      - Install `mypy` - static type checker for Python.
    2. Add new command `pipenv run lint`.
    3. Enable `mypy` in CI. Fix reported errors in `test_basics.py`.
    4. Renew readme.

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