Skip to content

Commit 403b16e

Browse files
author
Yair Fried
committed
fix pep8 on test_conf
1 parent 6466404 commit 403b16e

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

tools/kcli/tests/test_conf.py

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,23 @@
88

99
@pytest.fixture()
1010
def our_cwd_setup(request):
11+
"""Change cwd to test_cwd dir. Revert to original dir on teardown. """
12+
1113
bkp = os.getcwd()
14+
1215
def our_cwd_teardown():
1316
os.chdir(bkp)
17+
1418
request.addfinalizer(our_cwd_teardown)
1519
os.chdir(MYCWD)
1620

1721

18-
1922
@pytest.yield_fixture
2023
def os_environ():
21-
from kcli import conf
2224
"""Backups env var from os.environ and restores it at teardown. """
25+
26+
from kcli import conf
27+
2328
backup_flag = False
2429
if conf.ENV_VAR_NAME in os.environ:
2530
backup_flag = True
@@ -31,28 +36,6 @@ def os_environ():
3136

3237
def test_get_config_dir(our_cwd_setup):
3338
from kcli import conf
34-
file = conf.load_config_file()
35-
assert os.path.abspath(file.get("DEFAULTS", "KHALEESI_DIR")) == \
36-
os.path.abspath(MYCWD)
37-
38-
# # Negative - Missing input
39-
# with pytest.raises(ValueError) as exc:
40-
# core.get_config_dir(fake_config_cli(config_dir=None))
41-
# assert "Missing path" in str(exc.value)
42-
#
43-
# # Negative - Bad path
44-
# with pytest.raises(ValueError) as exc:
45-
# core.get_config_dir(fake_config_cli(config_dir="/fake/path"))
46-
# assert "Bad path" in str(exc.value)
47-
# assert "/fake/path" in str(exc.value)
48-
#
49-
# # verify CLI
50-
# assert core.get_config_dir(
51-
# fake_config_cli(config_dir=SETTINGS_DIR)) == SETTINGS_DIR
52-
53-
# Verify ENV
54-
55-
# # Verify CLI over ENV
56-
# os.environ["KHALEESI_SETTINGS"] = "/fake/env/path"
57-
# assert core.get_config_dir(
58-
# fake_config_cli(config_dir=SETTINGS_DIR)) == SETTINGS_DIR
39+
conf_file = conf.load_config_file()
40+
assert os.path.abspath(conf_file.get("DEFAULTS", "KHALEESI_DIR")) == \
41+
os.path.abspath(MYCWD)

0 commit comments

Comments
 (0)