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):
6363 if os .path .exists (VCR_CASSETES_DIR ):
6464 shutil .rmtree (VCR_CASSETES_DIR )
6565 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
6872
6973
7074@pytest .fixture (scope = 'session' )
@@ -112,8 +116,12 @@ def setup_vcrpy(request, hsproject):
112116 request .function .__module__ .split ('.' )[- 1 ],
113117 request .function .__name__
114118 )
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 ):
116123 remove_all_jobs (hsproject )
124+ with my_vcr .use_cassette (cassette_name ):
117125 yield
118126
119127
You can’t perform that action at this time.
0 commit comments