1. TL;DR example
STEP 1
Write this code:
File tests/some_module.py
@pytest.mark.record_curl
@pytest.mark.record_ftp
@pytest.mark.record_http
@pytest.mark.record_time
@pytest.mark.record_verify_screen
def test_some_test(record):
some_python_object = ...
record.add_verify(object=some_python_object)
STEP 2
Run:
pytest tests/some_module.py --record
It will:
Save all the Curl and urllib3 requests, as well as interactions with ftplib.
Save the execution datetime
Save the screen output
Save the data you provide to recorder object
STEP 3
Run:
pytest tests/some_module.py
It will:
Reuse the stored Curl and urllib3 requests
Reuse the same datetime to execute the test
Compare the current screen output to the previous one and raise and exception if different
Compare the current recorder object data to the previous one and raise and exception if different
2. Detailed example
CODE
@pytest.mark.record_curl
@pytest.mark.record_http
@pytest.mark.record_time(date=datetime(2023, 3, 1, 12, 0, 0), tic=False)
@pytest.mark.record_verify_screen(hash=True)
def test_some_test(record):
...
record.hash_only = True
record.add_verify(object=df)
record.add_verify(object=[df])
recorder.add_verify(
object=df,
)
USAGE
pytest [FILE] [--record[=none,all,curl,ftp,http,object,screen,time]] [--record-no-overwrite] [--record-no-hash]
FILES
For a given test_function from test_module, we will have the following files:
/tests/test_module.py:test_function
/tests/record/curl/test_module/test_function.yaml
/tests/record/ftp/test_module/test_function.yaml
/tests/record/http/test_module/test_function.yaml
/tests/record/object/test_module/test_function.json
/tests/record/object_hash/test_module/test_function.txt/json?
/tests/record/screen/test_module/test_function.txt/json?
/tests/record/screen_hash/test_module/test_function.txt/json?
/tests/record/time/test_module/test_function.txt/json?
Release files for pytest-recorder 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_recorder-1.0.0.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_recorder-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.0 kB
Release files / pytest_recorder-1.0.0.tar.gz
| Download URL | pytest_recorder-1.0.0.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1aebcb0b7c824b61bc0bc9a58f7aca84912a94da312d986c6cd0847a1c38d42e
|
|
BLAKE2b-256 checksum How to use checksums |
9a8a9c4fdf06777275fbc9d29b51153925a7cf7449d89439036de8e06daf454a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.11 Darwin/25.6.0
|
Release files / pytest_recorder-1.0.0-py3-none-any.whl
| Download URL | pytest_recorder-1.0.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb60f8cd2a836e9515db45f5fd5781798cc6ed6cee5994675322034fc762a7aa
|
|
BLAKE2b-256 checksum How to use checksums |
22b24234dbe4c5605c5be3ef9b882db0f07b4afb240ac762fef8f281816bf291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.11 Darwin/25.6.0
|