I usually check this with
```
if 'TRAVIS' in os.environ:
```