Skip to content

Commit a3c5168

Browse files
committed
add decorator to test function to skip test in CI environment
1 parent a6a76c2 commit a3c5168

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

mapswipe_workers/tests/integration/test_archive_project.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import tear_down
66

77
from mapswipe_workers import auth
8+
from mapswipe_workers.config import FIREBASE_DB
89
from mapswipe_workers.firebase_to_postgres import archive_project
910

1011

@@ -17,11 +18,17 @@ def setUp(self):
1718
def tearDown(self):
1819
tear_down.delete_test_data(self.project_id)
1920

21+
# This test is unreliable when running in Github Actions.
22+
# You should run this test locally.
23+
@unittest.skipIf(
24+
FIREBASE_DB == "ci-mapswipe",
25+
"Test is unreliable when running in Github Actions",
26+
)
2027
def test_changes(self):
2128
"""Test if groups, tasks and results are deleted from Firebase."""
2229
archive_project.archive_project([self.project_id])
2330

24-
time.sleep(5) # Wait for Firebase Functions to complete
31+
time.sleep(1) # Wait for Firebase Functions to complete
2532

2633
fb_db = auth.firebaseDB()
2734
ref = fb_db.reference(f"v2/groups/{self.project_id}")

mapswipe_workers/tests/integration/test_delete_project.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import tear_down
66

77
from mapswipe_workers import auth
8+
from mapswipe_workers.config import FIREBASE_DB
89
from mapswipe_workers.definitions import CustomError
910
from mapswipe_workers.firebase_to_postgres import delete_project
1011

@@ -18,6 +19,12 @@ def setUp(self):
1819
def tearDown(self):
1920
tear_down.delete_test_data(self.project_id)
2021

22+
# This test is unreliable when running in Github Actions.
23+
# You should run this test locally.
24+
@unittest.skipIf(
25+
FIREBASE_DB == "ci-mapswipe",
26+
"Test is unreliable when running in Github Actions",
27+
)
2128
def test_deletion(self):
2229
"""Test if tasks, groups, project and results are deleted."""
2330
delete_project.delete_project([self.project_id])

0 commit comments

Comments
 (0)