Registry / testing / pretenders

pretenders

JSON →
library1.4.5pypypiunverified

Pretenders provides fake implementations of external services (HTTP, SMTP, IMAP) for testing. Version 1.4.5 is the latest stable release; the project is maintained with irregular releases.

pip install pretenders
INSTALL
IMPORT
SIG · PRETENDERS
P
pretenders
testingpythonv1.4.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

PretenderServer
from pretenders.http import PretenderServer
from pretenders.http import PretenderServer

Starts a mock HTTP server, defines a mock response, and tests an HTTP call.

from pretenders.http import HTTPMock, PretenderServer # Start a mock HTTP server server = PretenderServer(host='127.0.0.1', port=8888) server.start() # Create a mock mock = HTTPMock('http://127.0.0.1:8888') mock.when('GET /api').respond(200, body='{"status": "ok"}') # Test your code import requests response = requests.get('http://127.0.0.1:8888/api') print(response.json()) # Cleanup server.stop()
pretenders-server --version
Debug
Known issues
deprecatedPretenders 1.4.x no longer supports Python 2.7; use Python 3.4+.
fix
Upgrade your environment to Python 3.4 or higher.
affects: >=1.4
gotchaFor SMTP mock, the popular 'smtp' subpackage is not available as of version 1.4. SMTP mock is unsupported according to release notes.
fix
Use the HTTP mock for testing, or consider other tools for SMTP testing.
affects: >=1.4
gotchaThe mock URL returned by HTTPMock may have a trailing path stripped incorrectly. Reported in issue #121 fixed in 1.4.
fix
Upgrade to 1.4 or later.
affects: <1.4
Upgrade
Version history
1.4.5latest on PyPI · released Jul 3, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
pretenders — pip install pretenders · libregistry