[aws unit test utils] only create a recordings directory when the env var is set (#45752)
* Only create placebo recording test directories when the environment variable PLACEBO_RECORD is set
(cherry picked from commit 5467ac3454
)
This commit is contained in:
parent
98e31e98c8
commit
af4971fd1a
1 changed files with 10 additions and 6 deletions
|
@ -61,12 +61,16 @@ def placeboify(request, monkeypatch):
|
||||||
# remove the test_ prefix from the function & file name
|
# remove the test_ prefix from the function & file name
|
||||||
).replace('test_', '')
|
).replace('test_', '')
|
||||||
|
|
||||||
try:
|
if not os.getenv('PLACEBO_RECORD'):
|
||||||
# make sure the directory for placebo test recordings is available
|
if not os.path.isdir(recordings_path):
|
||||||
os.makedirs(recordings_path)
|
raise NotImplementedError('Missing Placebo recordings in directory: %s' % recordings_path)
|
||||||
except OSError as e:
|
else:
|
||||||
if e.errno != errno.EEXIST:
|
try:
|
||||||
raise
|
# make sure the directory for placebo test recordings is available
|
||||||
|
os.makedirs(recordings_path)
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
|
|
||||||
pill = placebo.attach(session, data_path=recordings_path)
|
pill = placebo.attach(session, data_path=recordings_path)
|
||||||
if os.getenv('PLACEBO_RECORD'):
|
if os.getenv('PLACEBO_RECORD'):
|
||||||
|
|
Loading…
Reference in a new issue