Skip to main content

tests

Drone-CI Build Status

package

PyPI Package latest release Supported versions Supported implementations

What?

pytest_yield is a plugin that allows run tests as coroutines. This means that a few tests can being executing at same time.

Why?

This is first question that engineers asking. General theory said us that each test have to be run separetelly and independently, meaning without any influence on other tests. This plugin breaks this rules at all.

So why do we need it?

Imagine we have integration tests where each test execution takes very long time. For examle test should wait for some reactions depend on initial actions. This waiting could take up to e.g. 1 hour. And even after it we need perform next action from scenario and wait more. Syncronous execution of all tests, one by one, will take huge amout of time. But what if all test cases are independent, so actions of test1 does not influence results of test2. Than make sense some how skip waiting prosess of test1 and switch execution context to test2. This actually what pytest_yield doing.

How?

Each concurrent test is suppose to be a generator. Switching of execution context is performed after each yield. Test add itself to the end of a deueue if generator is not exausted yet. After new one is pulled from left side of dequeue. Assume test have N yields, tahn it will be N times rescheduled.

image2

Do not use with

Tests that are cross dependent. Most particular example is unittests with mocks, if test1 mock some method, this will be implicitly mocked in test2 also.

Download files

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

Source Distribution

pytest-yield-0.2.9.zip (16.8 kB view details)

Uploaded Source

File details

Details for the file pytest-yield-0.2.9.zip.

File metadata

  • Download URL: pytest-yield-0.2.9.zip
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14

File hashes

Hashes for pytest-yield-0.2.9.zip
Algorithm Hash digest
SHA256 8f8c8a738bbf8eea1c541ebd4ccc53388d14ca41da7143bd1346b61bc11b6a6a
MD5 39ba4127e3ace0c834ff5f23d165db50
BLAKE2b-256 0f1b4bcacf3c44323171399b9e9f15ccc4bd2f67b0196d2748febe73690672dc

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

1 file

This release

0.2.9 This release

1 file

0.2.8

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.3

1 file

0.1.1

1 file

0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page