Skip to content

Commit

Permalink
Reset environment variables after test
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvm committed Jan 15, 2015
1 parent a6169bf commit 7d0fd4b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@


def test_config_parser():
_environ = dict(os.environ)
os.environ['BLOCKS_CONFIG'] = os.path.join(os.getcwd(),
'.test_blocksrc')
assert not os.path.exists(os.environ['BLOCKS_CONFIG'])
with open(os.environ['BLOCKS_CONFIG'], 'w') as f:
f.write('data_path: yaml_path')
if 'BLOCKS_DATA_PATH' in os.environ:
del os.environ['BLOCKS_DATA_PATH']
try:
if 'BLOCKS_DATA_PATH' in os.environ:
del os.environ['BLOCKS_DATA_PATH']
config = Configuration()
config.add_config('data_path', str, env_var='BLOCKS_DATA_PATH')
config.add_config('config_with_default', int, default='1',
Expand All @@ -31,3 +31,5 @@ def test_config_parser():
'config_without_default')
finally:
os.remove(os.environ['BLOCKS_CONFIG'])
os.environ.clear()
os.environ.update(_environ)

0 comments on commit 7d0fd4b

Please sign in to comment.