kiwicom / pytest-recording

A pytest plugin that allows recording network interactions via VCR.py
MIT License
445 stars 35 forks source link

How to register matchers? #45

Closed paxcodes closed 4 years ago

paxcodes commented 4 years ago

I would like to register my own matcher.

I looked at pytest-recording's source and noticed vcr is in _vcr.py ; Since it starts with an underscore, I'm guessing that it's not meant to be imported outside of the package?

How do I register my own matcher with pytest-recording?

Stranger6667 commented 4 years ago

Hi!

At the moment it is not possible - I'll work on this feature

Stranger6667 commented 4 years ago

I think we can declare a new pytest hook, so it will be backward-compatible. Something like this:

def pytest_recording_configure(config, vcr):
    vcr.register_matcher(...)
Stranger6667 commented 4 years ago

This is released in 0.8.0. Let me know if it works for you :)

paxcodes commented 4 years ago

Thanks for the quick response there @Stranger6667! Yes, I was able to register my matcher. 👍🏼