Skip to content

Commit

Permalink
Skip mongo tests on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Lucey committed Aug 5, 2023
1 parent fcabae0 commit 66bf30b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/test_network_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
from shutil import copyfile, rmtree

from unittest import TestCase, skip
from unittest import TestCase, skip, skipUnless

from gridfs import GridFS
from networkx.classes.multidigraph import MultiDiGraph
Expand All @@ -13,22 +13,28 @@
from via.models.journey import Journey
from via.network_cache import NetworkCache

IS_ACTION = os.environ.get("IS_ACTION", "False") == "True"


class NetworkCacheTest(TestCase):

@skipUnless(not IS_ACTION, "action_mongo")
def setUp(self):
mongo_interface = get_mongo_interface()
getattr(mongo_interface, MONGO_NETWORKS_COLLECTION).drop()
grid = GridFS(mongo_interface)
for i in grid.find({"filename": {"$regex": f'^{re.escape("test_")}'}}):
grid.delete(i._id)

@skipUnless(not IS_ACTION, "action_mongo")
def tearDown(self):
mongo_interface = get_mongo_interface()
getattr(mongo_interface, MONGO_NETWORKS_COLLECTION).drop()
grid = GridFS(mongo_interface)
for i in grid.find({"filename": {"$regex": f'^{re.escape("test_")}'}}):
grid.delete(i._id)

@skipUnless(not IS_ACTION, "action_mongo")
def test_get_none(self):
data = []
for i in range(100):
Expand All @@ -46,6 +52,7 @@ def test_get_none(self):
cache = NetworkCache()
self.assertIsNone(cache.get(journey))

@skipUnless(not IS_ACTION, "action_mongo")
def test_set(self):
graph = MultiDiGraph()
graph_id = get_graph_id(graph)
Expand Down
2 changes: 2 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@


class UtilTest(TestCase):
@skipUnless(not IS_ACTION, "action_mongo")
def setUp(self):
mongo_interface = get_mongo_interface()
getattr(mongo_interface, MONGO_RAW_JOURNEYS_COLLECTION).drop()
Expand All @@ -51,6 +52,7 @@ def setUp(self):
for i in grid.find({"filename": {"$regex": f'^{re.escape("test_")}'}}):
grid.delete(i._id)

@skipUnless(not IS_ACTION, "action_mongo")
def tearDown(self):
mongo_interface = get_mongo_interface()
getattr(mongo_interface, MONGO_RAW_JOURNEYS_COLLECTION).drop()
Expand Down

0 comments on commit 66bf30b

Please sign in to comment.