[Mod] 修正测试

This commit is contained in:
nanoric 2019-04-14 05:58:18 -04:00
parent 5d0bf006c6
commit 6a7b9e139d
4 changed files with 18 additions and 7 deletions

View File

@ -13,6 +13,7 @@ services:
script:
# todo: use python unittest
- pip install psycopg2 mongoengine pymysql # we should support all database in test environment
- cd tests; source travis_env.sh; python test_all.py
matrix:

View File

@ -1,10 +1,10 @@
# tests/runner.py
import unittest
import app
# import your test modules
import test_import_all
import trader
import app
# initialize the test suite
loader = unittest.TestLoader()
@ -15,6 +15,17 @@ suite.addTests(loader.loadTestsFromModule(test_import_all))
suite.addTests(loader.loadTestsFromModule(trader))
suite.addTests(loader.loadTestsFromModule(app))
# initialize a runner, pass it your suite and run it
def main():
runner = unittest.TextTestRunner(verbosity=3)
result = runner.run(suite)
return result
if __name__ == '__main__':
result = main()
if result.failures:
exit(1)
else:
exit(0)

View File

@ -14,7 +14,7 @@ from vnpy.trader.constant import (Direction, Offset, Exchange,
Interval, Status)
from vnpy.trader.database import database_manager
from vnpy.trader.object import OrderData, TradeData, BarData, TickData
from vnpy.trader.utility import round_to_pricetick, extract_vt_symbol
from vnpy.trader.utility import round_to_pricetick
from .base import (
BacktestingMode,
@ -990,4 +990,3 @@ def load_tick_data(
return database_manager.load_tick_data(
symbol, exchange, start, end
)

View File

@ -4,8 +4,8 @@ from enum import Enum
from typing import Sequence, TYPE_CHECKING
if TYPE_CHECKING:
from vnpy.trader.constant import Interval, Exchange
from vnpy.trader.object import BarData, TickData
from vnpy.trader.constant import Interval, Exchange # noqa
from vnpy.trader.object import BarData, TickData # noqa
class Driver(Enum):