TestSlide fixture for pytest.
Quickstart
Install:
pip install pytest-testslide
In your test file:
import pytest
from pytest_testslide import testslide
from testslide import StrictMock # if you wish to use StrictMock
from testslide import matchers # if you wish to use Rspec style argument matchers
.....
def test_mock_callable_patching_works(testslide):
testslide.mock_callable(time, "sleep").to_raise(RuntimeError("Mocked!")) #mock_callable
with pytest.raises(RuntimeError):
time.sleep()
@pytest.mark.asyncio
async def test_mock_async_callable_patching_works(testslide):
testslide.mock_async_callable(sample_module.ParentTarget, "async_static_method").to_raise(RuntimeError("Mocked!")) #mock_async_callable
with pytest.raises(RuntimeError):
await sample_module.ParentTarget.async_static_method("a", "b")
def test_mock_constructor_patching_works(testslide):
testslide.mock_constructor(sample_module, "ParentTarget").to_raise(RuntimeError("Mocked!")) #mock_constructor
with pytest.raises(RuntimeError):
sample_module.ParentTarget()
def test_patch_attribute_patching_works(testslide):
testslide.patch_attribute(sample_module.SomeClass, "attribute", "patched") #patch_attribute
assert sample_module.SomeClass.attribute == "patched"
Metadata
Release files for pytest-testslide 2.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest-testslide-2.6.3.tar.gz | 2.8 kB | Without provenance | Details for pytest-testslide-2.6.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_testslide-2.6.3-py3-none-any.whl | Python 3 | none | any | Details for pytest_testslide-2.6.3-py3-none-any.whl |
Total release size: 5.5 kB
Release files / pytest-testslide-2.6.3.tar.gz
| Download URL | pytest-testslide-2.6.3.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b412bbe37711f6e4263b55363286ebd5fe021fbef3bdfa1a4f4bce8723719568
|
|
BLAKE2b-256 checksum How to use checksums |
50b7238e73b7d946bfdabf9f484a5902fee52be6c304b2e1b63aa6c2df0192e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.5
|
Release files / pytest_testslide-2.6.3-py3-none-any.whl
| Download URL | pytest_testslide-2.6.3-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bbce871a66e204b8ac3750a4cca5ca1eec44dba45649fcbad14651e7083bfea
|
|
BLAKE2b-256 checksum How to use checksums |
f109760b5a7d9de98554918cdbedcc0ed2fab689aae9689290d330187757b34e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.5
|
Security for pytest-testslide 2.6.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.