1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#!/usr/bin/env python
# coding: utf-8
"""
This module contains various configuration for the tests.
Some tests are skipped when run on a CI server because they are not
reproducible, see #243 (https://github.com/hardbyte/python-can/issues/243).
"""
import platform
from os import environ as environment
# ############################## Continuos integration
# see here for the environment variables that are set on the CI servers:
# - https://docs.travis-ci.com/user/environment-variables/
# - https://www.appveyor.com/docs/environment-variables/
IS_TRAVIS = environment.get('TRAVIS', '').lower() == 'true'
IS_APPVEYOR = environment.get('APPVEYOR', '').lower() == 'true'
IS_CI = IS_TRAVIS or IS_APPVEYOR or \
environment.get('CI', '').lower() == 'true' or \
environment.get('CONTINUOUS_INTEGRATION', '').lower() == 'true'
if IS_APPVEYOR and IS_TRAVIS:
raise EnvironmentError("IS_APPVEYOR and IS_TRAVIS cannot be both True at the same time")
# ############################## Platforms
_sys = platform.system().lower()
IS_WINDOWS = "windows" in _sys or ("win" in _sys and "darwin" not in _sys)
IS_LINUX = "linux" in _sys
IS_OSX = "darwin" in _sys
IS_UNIX = IS_LINUX or IS_OSX
if (IS_WINDOWS and IS_LINUX) or (IS_LINUX and IS_OSX) or (IS_WINDOWS and IS_OSX):
raise EnvironmentError(
"only one of IS_WINDOWS ({}), IS_LINUX ({}) and IS_OSX ({}) ".format(IS_WINDOWS, IS_LINUX, IS_OSX) +
"can be True at the same time " +
'(platform.system() == "{}")'.format(platform.system())
)
elif not IS_WINDOWS and not IS_LINUX and not IS_OSX:
raise EnvironmentError("one of IS_WINDOWS, IS_LINUX, IS_OSX has to be True")
# ############################## What tests to run
TEST_CAN_FD = True
TEST_INTERFACE_SOCKETCAN = IS_CI and IS_LINUX
|