I have a fixture and I want it to act differently depending on whether a cassete is playing back or not. Is there a way to check for this?
My first thought was to check the presence of a cassette with the same name of the running test, but I realized there are instances where there is a cassette but it's not playing back (for example, when --record-mode is rewrite or simply when the plugin is deactivated).
In case you're wondering why would I want do that, it's because my code makes some complex network requests using the pywin32 package that can't be done by requests. These requests won't be recorded and that's ok, but I don't want they being triggered when a cassette is playing back, so I intend to monkeypatch them but only in that case.
I have a fixture and I want it to act differently depending on whether a cassete is playing back or not. Is there a way to check for this?
My first thought was to check the presence of a cassette with the same name of the running test, but I realized there are instances where there is a cassette but it's not playing back (for example, when
--record-mode
isrewrite
or simply when the plugin is deactivated).In case you're wondering why would I want do that, it's because my code makes some complex network requests using the
pywin32
package that can't be done byrequests
. These requests won't be recorded and that's ok, but I don't want they being triggered when a cassette is playing back, so I intend to monkeypatch them but only in that case.