X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fhelper.py;h=935e0601f1ad9bbd82433ea841fd89474f1ad2c5;hb=5f721612111af5c56b5757cb2f21da5f2fa388bf;hp=fcb0e9dc3575d9c1426d016214fcc5183bde1e83;hpb=1d72880c097ea8259ce9cc63cfe55e6cc7516bd2;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/tests/helper.py b/tests/helper.py index fcb0e9d..935e060 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -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 @@ -32,11 +42,14 @@ class WebMockTestCase(unittest.TestCase): last_date=store.LockedVar(None), report=mock.Mock(), worker=None, + worker_tag="", worker_notify=None, worker_started=False, 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()