Skip to main content

### 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.

![](https://raw.githubusercontent.com/devova/pytest-yield/b0c7aa058df5f50cb9a05272fce01fc62a78bbee/how-it-works-pytest-yield.svg?sanitize=true) ### 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.

Metadata

Release files for pytest-yield 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-yield 0.1.6
File Size Uploaded
pytest-yield-0.1.6.zip 12.0 kB Details

Release files / pytest-yield-0.1.6.zip

Download URL pytest-yield-0.1.6.zip
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7390c2140501e14ff7b7febbc8c94218f2841be81214b58fa62490186311d899
BLAKE2b-256 checksum
How to use checksums
4712b9d0c78f0834360138e3d3e515974b5c80e0773a797ec25d98b31e7dd83b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0.0

1 release file

0.2.9

1 release file

0.2.8

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

This release

0.1.6 This release

1 release file

0.1.5

1 release file

0.1.3

1 release file

0.1.1

1 release file

0.1

1 release 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