|
12 | 12 | from os import environ as environment |
13 | 13 |
|
14 | 14 |
|
| 15 | +def env(name): # type: bool |
| 16 | + return environment.get(name, '').lower() in ("yes", "true", "t", "1") |
| 17 | + |
| 18 | + |
15 | 19 | # ############################## Continuos integration |
16 | 20 |
|
17 | 21 | # see here for the environment variables that are set on the CI servers: |
18 | 22 | # - https://docs.travis-ci.com/user/environment-variables/ |
19 | 23 | # - https://www.appveyor.com/docs/environment-variables/ |
20 | 24 |
|
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') |
23 | 27 |
|
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') |
27 | 29 |
|
28 | 30 | if IS_APPVEYOR and IS_TRAVIS: |
29 | 31 | raise EnvironmentError("IS_APPVEYOR and IS_TRAVIS cannot be both True at the same time") |
30 | 32 |
|
| 33 | + |
31 | 34 | # ############################## Platforms |
32 | 35 |
|
33 | 36 | _sys = platform.system().lower() |
|
42 | 45 | "can be True at the same time " + |
43 | 46 | '(platform.system() == "{}")'.format(platform.system()) |
44 | 47 | ) |
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 | + |
47 | 49 |
|
48 | 50 | # ############################## What tests to run |
49 | 51 |
|
50 | 52 | TEST_CAN_FD = True |
51 | 53 |
|
52 | | -TEST_INTERFACE_SOCKETCAN = IS_CI and IS_LINUX |
| 54 | +TEST_INTERFACE_SOCKETCAN = IS_LINUX and env('TEST_SOCKETCAN') |
0 commit comments