From baaa9453b46f59baa5c455845139ae53af56436e Mon Sep 17 00:00:00 2001 From: Ed Summers Date: Sun, 26 Apr 2020 12:28:19 -0400 Subject: [PATCH] Fixed test_environment_vars_in_config_file Some small changes to get this test to work. Unfortunately diffenigne.config is a global in the diffengine module, and changing it doesn't play nicely with the tests. I added a return value for diffengine.load_config that makes this easier. refs #67 --- .gitignore | 1 + diffengine/__init__.py | 1 + test_diffengine.py | 11 +++++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5cf1624..c8457e7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ diffengine.egg-info build Pip* .venv +.env diff --git a/diffengine/__init__.py b/diffengine/__init__.py index 7dadbee..5080aa2 100755 --- a/diffengine/__init__.py +++ b/diffengine/__init__.py @@ -367,6 +367,7 @@ def load_config(prompt=True): if prompt: config = get_initial_config() yaml.dump(config, open(config_file, "w"), default_flow_style=False) + return config def get_initial_config(): config = {"feeds": []} diff --git a/test_diffengine.py b/test_diffengine.py index c584ce0..bf6af7c 100644 --- a/test_diffengine.py +++ b/test_diffengine.py @@ -135,13 +135,12 @@ def test_environment_vars_in_config_file(): "public_value": public_value } } - config_file = home_path(test_home, "config.yaml"); + config_file = home_path("config.yaml"); yaml.dump(test_config, open(config_file, "w"), default_flow_style=False) # Test! - init("test") - config = get_initial_config() - assert config['example']['public_value'] == public_value - assert config['example']['private_value'] != private_yaml_key - assert config['example']['private_value'] == private_value + new_config = load_config() + assert new_config['example']['public_value'] == public_value + assert new_config['example']['private_value'] != private_yaml_key + assert new_config['example']['private_value'] == private_value