Skip to main content

Yandex.Taxi Testsuite Package

Project description

https://badge.fury.io/py/yandex-taxi-testsuite.svg https://github.com/yandex/yandex-taxi-testsuite/actions/workflows/ci.yml/badge.svg?branch=develop https://github.com/yandex/yandex-taxi-testsuite/actions/workflows/macos-ci.yml/badge.svg?branch=develop

What is testsuite

Testsuite is a microservice-oriented test framework written in Python based on pytest.

Testsuite is written and supported by Yandex.Taxi, and is used to test Yandex.Taxi microservices written in C++ and Python.

The principal suggested approach to testing - although not the only one - is black box, when the service is tested through http calls.

Direct read and write access from test to database is supported to enable precondition setup and result assertions.

Installation

Installation using pip:

pip3 install yandex-taxi-testsuite

# testsuite with mongodb support
pip3 install yandex-taxi-testsuite[mongodb]

# testsuite with postgresql support
pip3 install yandex-taxi-testsuite[postgresql]
pip3 install yandex-taxi-testsuite[postgresql-binary]

# testsuite with redis support
pip3 install yandex-taxi-testsuite[redis]

# testsuite with mysql support
pip3 install yandex-taxi-testsuite[mysql]

# testsuite with clickhouse support
pip3 install yandex-taxi-testsuite[clickhouse]

# testsuite with rabbitmq support
pip3 install yandex-taxi-testsuite[rabbitmq]

# testsuite with kafka support
pip3 install yandex-taxi-testsuite[kafka]

# testsuite with protobuf support
pip3 install yandex-taxi-testsuite[protobuf]

Supported databases

Out-of-the-box testsuite supports the following databases:

  • PostgreSQL

  • MongoDB

  • Redis/Valkey

  • MySQL/MariaDB 10+

  • ClickHouse

  • RabbitMQ

Supported operating systems

Testsuite runs on GNU/Linux and macOS operating systems.

Principle of operation

Testsuite sets up the environment for the service being tested:

  • Testsuite starts any required databases (postgresql, mongo, redis).

  • Before each test, testsuite fills the database with test data.

  • Testsuite starts its own web server (mockserver), which mimics (mocks) microservices other than the one being tested.

Testsuite starts the microservice being tested in a separate process.

Testsuite then runs tests.

A test performs http requests to the service and verifies that the requests were processed properly.

A test may check the results of an http call by looking directly into the service’s database.

A test may check whether the service has made calls to external services, as well as the order of calls and the data that was sent and received.

A test may check the internal state of the service as represented by the data the service sent to the test with the testpoint mechanism.

Source code

Testsuite open-source edition code is available here.

Documentation

For full documentation, including installation, tutorials, please see https://yandex.github.io/yandex-taxi-testsuite/.

Running testsuite

self-tests:

pytest3 ./tests

tests of example services:

cd docs/examples && make

Development

Setup virtual env

In order to test your modifications it’s useful to run testsuite inside virtualenv. Use the following command to create developer’s venv:

make setup-dev-venv

Virtualenv will be created in .venv-dev directory.

Code format and linters

Auto format source code:

make venv-format

Run linters:

make venv-check-linters
make venv-check-mypy

You can also add pre-commit hook which will run ruff and linters for you:

make install-pre-commit-hooks

Running tests

You can run tests using Makefile:

make venv-tests

Or directly using pytest:

make setup-dev-venv                  # Setup virtual env first
. .venv-dev/bin/activate             # Activate virtualenv
pytest -vv tests/plugins/mockserver  # Finally run pytest

Building documentation

make build-docs

Contributing

  • Fork project

  • Write code in your own branch

  • Test your code

  • Run linters and code formatters

  • Add new changelog entry

  • Create pull request on github

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yandex_taxi_testsuite-0.4.7.tar.gz (111.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yandex_taxi_testsuite-0.4.7-py3-none-any.whl (147.8 kB view details)

Uploaded Python 3

File details

Details for the file yandex_taxi_testsuite-0.4.7.tar.gz.

File metadata

  • Download URL: yandex_taxi_testsuite-0.4.7.tar.gz
  • Upload date:
  • Size: 111.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for yandex_taxi_testsuite-0.4.7.tar.gz
Algorithm Hash digest
SHA256 ba2b456041fc91bbd0c90bc43818ff8dbe996eb4833c3018f8aef0105a87ea5e
MD5 ee8cf07338c769bc64b1f40636c01417
BLAKE2b-256 22304694eb43f556e3267deae911d124e8702e62ecfda70986d6805b8bbd2e8f

See more details on using hashes here.

File details

Details for the file yandex_taxi_testsuite-0.4.7-py3-none-any.whl.

File metadata

File hashes

Hashes for yandex_taxi_testsuite-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7c4b927ba7ac87a3236d5ad61cd8ee649f8b4be948abe50f97bb84ea84b57c55
MD5 51e3650ef0f6cb9279c551cc493d61b2
BLAKE2b-256 c91edb9dcd44afa3a95bb4528f8a05c82a99d1fa84836f4e4d658ce1a6e838b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page