Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom VCR config via separate fixture #2

Closed
Stranger6667 opened this issue Jul 18, 2019 · 0 comments
Closed

Custom VCR config via separate fixture #2

Stranger6667 opened this issue Jul 18, 2019 · 0 comments
Assignees

Comments

@Stranger6667
Copy link
Collaborator

Currently, there is no way to specify a module/session-level config without wrapping everything with pytest.mark.vcr.
E.g. test module has 10 tests, 2 of them use pytest.mark.vcr - if they share the same config it will require manual explicit specification on each mark, which means some duplication. An alternative solution is to have a separate fixture of any scope - vcr_config that will be added to the VCR config implicitly (like it is in pytest-vcr).


@pytest.fixture(scope="module")
def vcr_config():
    return {}


@pytest.mark.vcr
def test_a():
    pass


@pytest.mark.vcr
def test_b():
    pass


def test_c():
    pass

In this case, we can avoid VCR setup where it is not needed and the vcr_config fixture could be the first in the merging process - all marks will override colliding keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant