[Mod] 修正测试
This commit is contained in:
parent
5d0bf006c6
commit
6a7b9e139d
@ -13,6 +13,7 @@ services:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
# todo: use python unittest
|
# 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
|
- cd tests; source travis_env.sh; python test_all.py
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# tests/runner.py
|
# tests/runner.py
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import app
|
||||||
# import your test modules
|
# import your test modules
|
||||||
import test_import_all
|
import test_import_all
|
||||||
import trader
|
import trader
|
||||||
import app
|
|
||||||
|
|
||||||
# initialize the test suite
|
# initialize the test suite
|
||||||
loader = unittest.TestLoader()
|
loader = unittest.TestLoader()
|
||||||
@ -15,6 +15,17 @@ suite.addTests(loader.loadTestsFromModule(test_import_all))
|
|||||||
suite.addTests(loader.loadTestsFromModule(trader))
|
suite.addTests(loader.loadTestsFromModule(trader))
|
||||||
suite.addTests(loader.loadTestsFromModule(app))
|
suite.addTests(loader.loadTestsFromModule(app))
|
||||||
|
|
||||||
|
|
||||||
# initialize a runner, pass it your suite and run it
|
# initialize a runner, pass it your suite and run it
|
||||||
|
def main():
|
||||||
runner = unittest.TextTestRunner(verbosity=3)
|
runner = unittest.TextTestRunner(verbosity=3)
|
||||||
result = runner.run(suite)
|
result = runner.run(suite)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
result = main()
|
||||||
|
if result.failures:
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
exit(0)
|
||||||
|
@ -14,7 +14,7 @@ from vnpy.trader.constant import (Direction, Offset, Exchange,
|
|||||||
Interval, Status)
|
Interval, Status)
|
||||||
from vnpy.trader.database import database_manager
|
from vnpy.trader.database import database_manager
|
||||||
from vnpy.trader.object import OrderData, TradeData, BarData, TickData
|
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 (
|
from .base import (
|
||||||
BacktestingMode,
|
BacktestingMode,
|
||||||
@ -990,4 +990,3 @@ def load_tick_data(
|
|||||||
return database_manager.load_tick_data(
|
return database_manager.load_tick_data(
|
||||||
symbol, exchange, start, end
|
symbol, exchange, start, end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ from enum import Enum
|
|||||||
from typing import Sequence, TYPE_CHECKING
|
from typing import Sequence, TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from vnpy.trader.constant import Interval, Exchange
|
from vnpy.trader.constant import Interval, Exchange # noqa
|
||||||
from vnpy.trader.object import BarData, TickData
|
from vnpy.trader.object import BarData, TickData # noqa
|
||||||
|
|
||||||
|
|
||||||
class Driver(Enum):
|
class Driver(Enum):
|
||||||
|
Loading…
Reference in New Issue
Block a user