From 96b29a528877f390476791562413514f6dd085ad Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Wed, 25 May 2016 21:27:51 -0400 Subject: [PATCH] tests: Read environment file if it exists. --- tests/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..88411ba --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,16 @@ +import os + + +def setup_module(): + try: + with open('build/test-environment') as env_file: + for line in env_file: + if line.startswith('export '): + line = line[7:] + name, sep, value = line.strip().partition('=') + if value: + os.environ[name] = value + else: + os.environ.pop(name, None) + except IOError: + pass