]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/blobdiff - tests/helper.py
Don’t raise when some market is disabled
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git] / tests / helper.py
index 4548b169f430ed0abbd6e78ddc1963171fc5e1c9..a2f8a2243c5e6966a96ccda794741291970d201a 100644 (file)
@@ -4,11 +4,21 @@ from decimal import Decimal as D
 from unittest import mock
 import requests_mock
 from io import StringIO
-import portfolio, market, main, store
+import portfolio, market, main, store, dbs
 
-__all__ = ["unittest", "WebMockTestCase", "mock", "D",
+__all__ = ["limits", "unittest", "WebMockTestCase", "mock", "D",
         "StringIO"]
 
+limits = ["acceptance", "unit"]
+for test_type in limits:
+    if "--no{}".format(test_type) in sys.argv:
+        sys.argv.remove("--no{}".format(test_type))
+        limits.remove(test_type)
+    if "--only{}".format(test_type) in sys.argv:
+        sys.argv.remove("--only{}".format(test_type))
+        limits = [test_type]
+        break
+
 class WebMockTestCase(unittest.TestCase):
     import time
 
@@ -35,9 +45,12 @@ class WebMockTestCase(unittest.TestCase):
                     worker_tag="",
                     worker_notify=None,
                     worker_started=False,
+                    poll_started_at=None,
                     callback=None),
                 mock.patch.multiple(portfolio.Computation,
                     computations=portfolio.Computation.computations),
+                mock.patch.multiple(dbs,
+                    redis=None, psql=None)
                 ]
         for patcher in self.patchers:
             patcher.start()