File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -63,8 +63,12 @@ def pytest_configure(config):
63
63
if os .path .exists (VCR_CASSETES_DIR ):
64
64
shutil .rmtree (VCR_CASSETES_DIR )
65
65
elif config .option .ignore_cassettes :
66
- # TODO somehow skip cassettes
67
- pass
66
+ # simple hack to just ignore vcr cassettes:
67
+ # - all record_mode means recording new interactions + no replay
68
+ # - before_record returning None means skipping all the requests
69
+ global my_vcr
70
+ my_vcr .record_mode = 'all'
71
+ my_vcr .before_record_request = lambda request : None
68
72
69
73
70
74
@pytest .fixture (scope = 'session' )
@@ -112,8 +116,12 @@ def setup_vcrpy(request, hsproject):
112
116
request .function .__module__ .split ('.' )[- 1 ],
113
117
request .function .__name__
114
118
)
115
- with my_vcr .use_cassette (cassette_name ):
119
+ # we should clean jobs only when working with real services
120
+ # doesn't make sense to clean jobs when working with cassettes
121
+ if (request .config .option .update_cassettes or
122
+ request .config .option .ignore_cassettes ):
116
123
remove_all_jobs (hsproject )
124
+ with my_vcr .use_cassette (cassette_name ):
117
125
yield
118
126
119
127
You can’t perform that action at this time.
0 commit comments