From 099b5292fe2a0a7e88a3bd408fc01114c70644cc Mon Sep 17 00:00:00 2001 From: nanoric Date: Fri, 5 Jul 2019 14:50:36 +0800 Subject: [PATCH] [Mod] skip tests if extensions not built. --- tests/test_import_all.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_import_all.py b/tests/test_import_all.py index f5969556..6ebe6e78 100644 --- a/tests/test_import_all.py +++ b/tests/test_import_all.py @@ -1,6 +1,11 @@ # flake8: noqa import platform import unittest +from os import environ + + +def check_env(key: str, default=None): + return environ.get(key, default) # noinspection PyUnresolvedReferences,PyMethodMayBeStatic @@ -33,6 +38,7 @@ class GatewayImportTest(unittest.TestCase): from vnpy.gateway.ctp import CtpGateway @unittest.skipIf(platform.system() == "Darwin", "Not supported yet under osx") + @unittest.skipIf(platform.system() == "Linux", "Not supported yet under Linux") def test_import_ctptest(self): from vnpy.gateway.ctptest import CtptestGateway @@ -54,6 +60,7 @@ class GatewayImportTest(unittest.TestCase): from vnpy.gateway.ib import IbGateway @unittest.skipIf(platform.system() == "Darwin", "Not supported yet under osx") + @unittest.skipIf(check_env('VNPY_BUILD_OES') == '0', "Skip because of VNPY_BUILD_OES==0") def test_import_oes(self): from vnpy.gateway.oes import OesGateway @@ -75,6 +82,7 @@ class GatewayImportTest(unittest.TestCase): from vnpy.gateway.tiger import TigerGateway @unittest.skipIf(platform.system() == "Darwin", "Not supported yet under osx") + @unittest.skipIf(platform.system() == "Linux", "Not supported yet under Linux") def test_import_tora(self): from vnpy.gateway.tora import ToraGateway