kopia lustrzana https://github.com/halcy/Mastodon.py
Merge pull request #407 from CyberTailor/master
Switch from `pytest-vcr` to `pytest-recording`master
commit
c563d53b21
|
@ -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
|
* 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
|
* 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.
|
setting up a mastodon dev server. Further documentation can be found in the "tests" directory in the repository.
|
||||||
|
|
|
@ -41,7 +41,7 @@ test = [
|
||||||
'pytest',
|
'pytest',
|
||||||
'pytest-cov',
|
'pytest-cov',
|
||||||
'vcrpy',
|
'vcrpy',
|
||||||
'pytest-vcr',
|
'pytest-recording',
|
||||||
'pytest-mock',
|
'pytest-mock',
|
||||||
'requests-mock',
|
'requests-mock',
|
||||||
'pytz',
|
'pytz',
|
||||||
|
@ -51,7 +51,7 @@ test_old = [
|
||||||
'pytest',
|
'pytest',
|
||||||
'pytest-cov',
|
'pytest-cov',
|
||||||
'vcrpy',
|
'vcrpy',
|
||||||
'pytest-vcr',
|
'pytest-recording',
|
||||||
'pytest-mock',
|
'pytest-mock',
|
||||||
'requests-mock',
|
'requests-mock',
|
||||||
'pytz',
|
'pytz',
|
||||||
|
|
|
@ -405,7 +405,7 @@
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Generate code for testing the entities\n",
|
"# 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",
|
"# that retrieves it (see Entity Verification above). The test then checks the type against the expected type.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# mastodon_base (mastodon_soc) and mastodon_admin (mastodon_ico_admin) are used to retrieve the entities. These are provided\n",
|
"# mastodon_base (mastodon_soc) and mastodon_admin (mastodon_ico_admin) are used to retrieve the entities. These are provided\n",
|
||||||
|
|
|
@ -63,6 +63,11 @@ def vcr_config():
|
||||||
decode_compressed_response = True
|
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
|
# Fixtures for testing against actual, real servers
|
||||||
# Please be extremely careful with these
|
# Please be extremely careful with these
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
@ -14,11 +14,6 @@ streaming_is_patched = False
|
||||||
real_connections = []
|
real_connections = []
|
||||||
close_connections = False
|
close_connections = False
|
||||||
|
|
||||||
@pytest.fixture(scope='module')
|
|
||||||
def vcr(vcr):
|
|
||||||
vcr.match_on = ['path']
|
|
||||||
return vcr
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module')
|
@pytest.fixture(scope='module')
|
||||||
def vcr_config():
|
def vcr_config():
|
||||||
return {
|
return {
|
||||||
|
|
Ładowanie…
Reference in New Issue