Skip to content

Commit f754a79

Browse files
committed
fix test config
1 parent beedd79 commit f754a79

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

test/config.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,25 @@
1212
from os import environ as environment
1313

1414

15+
def env(name): # type: bool
16+
return environment.get(name, '').lower() in ("yes", "true", "t", "1")
17+
18+
1519
# ############################## Continuos integration
1620

1721
# see here for the environment variables that are set on the CI servers:
1822
# - https://docs.travis-ci.com/user/environment-variables/
1923
# - https://www.appveyor.com/docs/environment-variables/
2024

21-
IS_TRAVIS = environment.get('TRAVIS', '').lower() == 'true'
22-
IS_APPVEYOR = environment.get('APPVEYOR', '').lower() == 'true'
25+
IS_TRAVIS = env('TRAVIS')
26+
IS_APPVEYOR = env('APPVEYOR')
2327

24-
IS_CI = IS_TRAVIS or IS_APPVEYOR or \
25-
environment.get('CI', '').lower() == 'true' or \
26-
environment.get('CONTINUOUS_INTEGRATION', '').lower() == 'true'
28+
IS_CI = IS_TRAVIS or IS_APPVEYOR or env('CI') or env('CONTINUOUS_INTEGRATION')
2729

2830
if IS_APPVEYOR and IS_TRAVIS:
2931
raise EnvironmentError("IS_APPVEYOR and IS_TRAVIS cannot be both True at the same time")
3032

33+
3134
# ############################## Platforms
3235

3336
_sys = platform.system().lower()
@@ -42,11 +45,10 @@
4245
"can be True at the same time " +
4346
'(platform.system() == "{}")'.format(platform.system())
4447
)
45-
elif not IS_WINDOWS and not IS_LINUX and not IS_OSX:
46-
raise EnvironmentError("one of IS_WINDOWS, IS_LINUX, IS_OSX has to be True")
48+
4749

4850
# ############################## What tests to run
4951

5052
TEST_CAN_FD = True
5153

52-
TEST_INTERFACE_SOCKETCAN = IS_CI and IS_LINUX
54+
TEST_INTERFACE_SOCKETCAN = IS_LINUX and env('TEST_SOCKETCAN')

0 commit comments

Comments
 (0)