I'm using django-nose
to run my tests and I need to know when they are running from inside my views/models methods/etc so I can skip stuff like checking cache values or calling some project-external resources for example only when running the tests.
It would be good to have some sort of environment variable available or something similar so I could do something like:
if os.environ.get('TESTS_ARE_RUNNING'):
# skip this
or
if not TESTS_ARE_RUNNING:
# do something
Does anybody know a way to accomplish this?
Thanks in advance for any help :)