From 05c653f08c65204f71ad2574499d307ba3baee7b Mon Sep 17 00:00:00 2001 From: thenav56 Date: Mon, 6 Nov 2023 15:01:37 +0545 Subject: [PATCH] Skip temp-media files delete in CI --- deep/tests/test_case.py | 3 ++- utils/graphene/tests.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/deep/tests/test_case.py b/deep/tests/test_case.py index 5fb0366324..7cae8e650b 100644 --- a/deep/tests/test_case.py +++ b/deep/tests/test_case.py @@ -78,7 +78,8 @@ def setUp(self): # This should be called here to access roles later self.create_project_roles() self.deep_test_files_path = [] - if not os.path.exists(TEST_MEDIA_ROOT): + # NOTE: CI will clean itself + if os.environ.get('CI', '').lower() != 'true' and not os.path.exists(TEST_MEDIA_ROOT): os.makedirs(TEST_MEDIA_ROOT) super().setUp() diff --git a/utils/graphene/tests.py b/utils/graphene/tests.py index f274525947..7a7af4b9c9 100644 --- a/utils/graphene/tests.py +++ b/utils/graphene/tests.py @@ -47,7 +47,9 @@ def tearDownClass(cls): super().tearDownClass() # clear the temporary media files try: - shutil.rmtree(os.path.join(settings.BASE_DIR, TEST_MEDIA_ROOT), ignore_errors=True) + # NOTE: CI will clean itself + if os.environ.get('CI', '').lower() != 'true': + shutil.rmtree(os.path.join(settings.BASE_DIR, TEST_MEDIA_ROOT), ignore_errors=True) except FileNotFoundError: pass