diff --git a/.travis.yml b/.travis.yml index 0324742b..b1268f55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,21 +49,6 @@ matrix: - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - bash ./install.sh - - name: "pip install under osx" - os: osx - language: shell # osx supports only shell - services: [] - before_install: [] - install: - - pip3 install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - - bash ./install_osx.sh - before_script: [] - script: - - pip3 install psycopg2 mongoengine pymysql # we should support all database in test environment - - cd tests; source travis_env.sh; - # osx is complicated for me, skip the tests - # python3 test_all.py - - name: "sdist install under Ubuntu: gcc-8" addons: apt: @@ -93,3 +78,16 @@ matrix: - python setup.py sdist - pip install dist/`ls dist` + - name: "pip install under osx" + os: osx + language: shell # osx supports only shell + services: [] + before_install: [] + install: + - pip3 install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl + - bash ./install_osx.sh + before_script: [] + script: + - pip3 install psycopg2 mongoengine pymysql # we should support all database in test environment + - cd tests; source travis_env.sh; + - VNPY_TEST_ONLY_SQLITE=1 python3 test_all.py diff --git a/tests/trader/test_database.py b/tests/trader/test_database.py index 59f1dcfc..df009baf 100644 --- a/tests/trader/test_database.py +++ b/tests/trader/test_database.py @@ -15,33 +15,36 @@ profiles = { Driver.SQLITE: { "driver": "sqlite", "database": "test_db.db", - }, - Driver.MYSQL: { - "driver": "mysql", - "database": os.environ['VNPY_TEST_MYSQL_DATABASE'], - "host": os.environ['VNPY_TEST_MYSQL_HOST'], - "port": int(os.environ['VNPY_TEST_MYSQL_PORT']), - "user": os.environ["VNPY_TEST_MYSQL_USER"], - "password": os.environ['VNPY_TEST_MYSQL_PASSWORD'], - }, - Driver.POSTGRESQL: { - "driver": "postgresql", - "database": os.environ['VNPY_TEST_POSTGRESQL_DATABASE'], - "host": os.environ['VNPY_TEST_POSTGRESQL_HOST'], - "port": int(os.environ['VNPY_TEST_POSTGRESQL_PORT']), - "user": os.environ["VNPY_TEST_POSTGRESQL_USER"], - "password": os.environ['VNPY_TEST_POSTGRESQL_PASSWORD'], - }, - Driver.MONGODB: { - "driver": "mongodb", - "database": os.environ['VNPY_TEST_MONGODB_DATABASE'], - "host": os.environ['VNPY_TEST_MONGODB_HOST'], - "port": int(os.environ['VNPY_TEST_MONGODB_PORT']), - "user": "", - "password": "", - "authentication_source": "", - }, + } } +if 'VNPY_TEST_ONLY_SQLITE' not in os.environ: + profiles.update({ + Driver.MYSQL: { + "driver": "mysql", + "database": os.environ['VNPY_TEST_MYSQL_DATABASE'], + "host": os.environ['VNPY_TEST_MYSQL_HOST'], + "port": int(os.environ['VNPY_TEST_MYSQL_PORT']), + "user": os.environ["VNPY_TEST_MYSQL_USER"], + "password": os.environ['VNPY_TEST_MYSQL_PASSWORD'], + }, + Driver.POSTGRESQL: { + "driver": "postgresql", + "database": os.environ['VNPY_TEST_POSTGRESQL_DATABASE'], + "host": os.environ['VNPY_TEST_POSTGRESQL_HOST'], + "port": int(os.environ['VNPY_TEST_POSTGRESQL_PORT']), + "user": os.environ["VNPY_TEST_POSTGRESQL_USER"], + "password": os.environ['VNPY_TEST_POSTGRESQL_PASSWORD'], + }, + Driver.MONGODB: { + "driver": "mongodb", + "database": os.environ['VNPY_TEST_MONGODB_DATABASE'], + "host": os.environ['VNPY_TEST_MONGODB_HOST'], + "port": int(os.environ['VNPY_TEST_MONGODB_PORT']), + "user": "", + "password": "", + "authentication_source": "", + }, + }) def now():