X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fhelper.py;h=930d04a4cc17f86fbe945794a2716834f07f332e;hb=8bbca32edc344c7ee2f5ea5db5448a4c4ff79684;hp=4548b169f430ed0abbd6e78ddc1963171fc5e1c9;hpb=c5a3b4e8c00f8d7bb54b342b1dd43c08bbfbd4db;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/tests/helper.py b/tests/helper.py index 4548b16..930d04a 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -4,10 +4,24 @@ 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 +import datetime -__all__ = ["unittest", "WebMockTestCase", "mock", "D", - "StringIO"] +__all__ = ["limits", "unittest", "WebMockTestCase", "mock", "D", + "StringIO", "tz"] + +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 + +def tz(hours): + return datetime.timezone(datetime.timedelta(hours=hours)) class WebMockTestCase(unittest.TestCase): import time @@ -35,9 +49,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()