diff options
author | Sloane Hertel <shertel@redhat.com> | 2018-09-17 18:16:44 -0400 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2018-09-19 13:28:00 -0700 |
commit | af4971fd1a72e18051c7b1b0138de73975bd9290 (patch) | |
tree | 2760f303042bcccabcad4786f869bb5ba229758a | |
parent | 98e31e98c80f335c9f33fce12462e75fb2ce0c97 (diff) | |
download | ansible-af4971fd1a72e18051c7b1b0138de73975bd9290.tar.gz |
[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 5467ac3454d684470917ddf399b3a9bbd430488d)
-rw-r--r-- | test/units/utils/amazon_placebo_fixtures.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/units/utils/amazon_placebo_fixtures.py b/test/units/utils/amazon_placebo_fixtures.py index 5c49845817..000cca1b40 100644 --- a/test/units/utils/amazon_placebo_fixtures.py +++ b/test/units/utils/amazon_placebo_fixtures.py @@ -61,12 +61,16 @@ def placeboify(request, monkeypatch): # remove the test_ prefix from the function & file name ).replace('test_', '') - try: - # make sure the directory for placebo test recordings is available - os.makedirs(recordings_path) - except OSError as e: - if e.errno != errno.EEXIST: - raise + if not os.getenv('PLACEBO_RECORD'): + if not os.path.isdir(recordings_path): + raise NotImplementedError('Missing Placebo recordings in directory: %s' % recordings_path) + else: + try: + # 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) if os.getenv('PLACEBO_RECORD'): |