Registry / testing / testslide

testslide

JSON →
library2.7.1pypypi✓ verified 84d ago

A test framework for Python that makes mocking and iterating over code with tests a breeze. Current version 2.7.1 (2022). Release cadence is irregular.

pip install testslide
INSTALL
IMPORT
SIG · TESTSLIDE
T
testslide
testingpythonv2.7.1
Install
3.4s avg
Import
Disk
27MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 29.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.4s · import 0.000s · 30MB
27MB installed
● package 27MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TestCase
from testslide import TestCase
from testslide import TestSlideTestCase

Basic mocking example using TestSlide.

import testslide def test_example(testslide_context): mock = testslide.mock_callable('os.getcwd') mock.to_return('/mock/path') assert os.getcwd() == '/mock/path'
Debug
Known issues
gotchaTestSlide's mock_callable patches functions by string name (e.g., 'os.getcwd'), not by object reference. Ensure the string matches the import path used in the code under test.
fix
Use the exact dotted string as imported in the module under test.
affects: all
gotchaTestSlide uses a context-based approach: tests must accept a `testslide_context` parameter or use `with testslide.Context(...)`.
fix
Define test functions with an extra parameter named `testslide_context` or use the context manager.
affects: all
gotchaStrictMock raises AttributeError on access to unexpected attributes. This is by design but can be surprising if you misspell an attribute.
fix
Use `mock.to_return(...)` or `mock.to_raise(...)` for expected attributes.
affects: all
Upgrade
Version history
2.7.1latest on PyPI · released Mar 16, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
testslide — pip install testslide · libregistry