Merge pull request #407 from CyberTailor/master

Switch from `pytest-vcr` to `pytest-recording`
master
Lorenz Diener 2025-06-18 16:33:56 +03:00 zatwierdzone przez GitHub
commit c563d53b21
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
5 zmienionych plików z 9 dodań i 9 usunięć

Wyświetl plik

@ -29,5 +29,5 @@ Mastodon.py has an extensive suite of tests. The purpose of these is twofold:
* Make sure nothing is broken and that there aren't any regressions
* Where the official docs are unclear, verify assumptions we make about the Mastodon API and document the results
The tests use pytest and pytest-vcr so that they can be ran even without a mastodon server, but new tests require
The tests use pytest and pytest-recording so that they can be ran even without a mastodon server, but new tests require
setting up a mastodon dev server. Further documentation can be found in the "tests" directory in the repository.

Wyświetl plik

@ -41,7 +41,7 @@ test = [
'pytest',
'pytest-cov',
'vcrpy',
'pytest-vcr',
'pytest-recording',
'pytest-mock',
'requests-mock',
'pytz',
@ -51,7 +51,7 @@ test_old = [
'pytest',
'pytest-cov',
'vcrpy',
'pytest-vcr',
'pytest-recording',
'pytest-mock',
'requests-mock',
'pytz',

Wyświetl plik

@ -405,7 +405,7 @@
"outputs": [],
"source": [
"# Generate code for testing the entities\n",
"# Tests are generated using pytest-vcr. Every entity gets a test, constructed to call the function (or two functions)\n",
"# Tests are generated using pytest-recording. Every entity gets a test, constructed to call the function (or two functions)\n",
"# that retrieves it (see Entity Verification above). The test then checks the type against the expected type.\n",
"\n",
"# mastodon_base (mastodon_soc) and mastodon_admin (mastodon_ico_admin) are used to retrieve the entities. These are provided\n",

Wyświetl plik

@ -63,6 +63,11 @@ def vcr_config():
decode_compressed_response = True
)
@pytest.fixture(scope="module")
def vcr_cassette_dir(request) -> str:
module = request.node.fspath # current test file
return os.path.join(module.dirname, "cassettes")
# Fixtures for testing against actual, real servers
# Please be extremely careful with these
@pytest.fixture

Wyświetl plik

@ -14,11 +14,6 @@ streaming_is_patched = False
real_connections = []
close_connections = False
@pytest.fixture(scope='module')
def vcr(vcr):
vcr.match_on = ['path']
return vcr
@pytest.fixture(scope='module')
def vcr_config():
return {