Skip to content

Commit

Permalink
Test: Removes all test yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
dgasmith committed Aug 14, 2018
1 parent 86657ce commit fcb2a9e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 31 deletions.
2 changes: 1 addition & 1 deletion qcengine/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def load_options(load_path):
else:
raise TypeError("Unknown options load")

_globals["config_path"] = load_path
_globals["config_path"] = None

# Override default keys
default_keys = list(_globals["default_compute"].keys())
Expand Down
5 changes: 0 additions & 5 deletions qcengine/tests/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ def _plugin_import(plug):
else:
return True


# Modify paths for testing
os.environ["DQM_CONFIG_PATH"] = os.path.dirname(os.path.abspath(__file__))
os.environ["TMPDIR"] = "/tmp/"

# Add flags
using_psi4 = pytest.mark.skipif(
_plugin_import("psi4") is False, reason="could not find psi4. please install the package to enable tests")
Expand Down
19 changes: 0 additions & 19 deletions qcengine/tests/conf_basic.yaml

This file was deleted.

44 changes: 38 additions & 6 deletions qcengine/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,51 @@ def opt_state_basic():
"""
Capture the options state and temporarily override.
"""
tmp = copy.deepcopy(dc.config._globals)

base_path = os.path.dirname(os.path.abspath(__file__))
dc.load_options(os.path.join(base_path, "conf_basic.yaml"))
# Snapshot env
old_globals = copy.deepcopy(dc.config._globals)
old_environ = dict(os.environ)

os.environ["TMPDIR"] = "/tmp/"

config = {
"default_compute": {
"psi_path": "/home/user/psi4",
"jobs_per_node": 1,
"nthreads_per_job": 2,
"memory_per_job": 4,
"scratch_directory": "$TMPDIR"
},
"other_compute": {
"dragonsooth": {
"psi_path": "/home/user/dt/psi4",
"hostname": "dt*",
"jobs_per_node": 2,
"nthreads_per_job": 6,
"memory_per_job": 60,
"scratch_directory": "$NOVAR_RANDOM_ABC123"
},
"new_river": {
"hostname": "nr*",
"jobs_per_node": 2,
"nthreads_per_job": 12,
"memory_per_job": 120
}
}
}

dc.load_options(config)

yield

dc.config._globals = tmp
# Reset env
os.environ.update(old_environ)
dc.config._globals = old_globals


def test_config_path(opt_state_basic):
cpath = dc.config.get_global("config_path")
test_path = os.path.join("qcengine", "test")
assert test_path in cpath
assert cpath is None


def test_get_default(opt_state_basic):
Expand All @@ -52,6 +83,7 @@ def test_default_matches(opt_state_basic):

def test_environmental_vars(opt_state_basic):

print(dc.get_config("scratch_directory"))
assert dc.get_config("scratch_directory") == "/tmp/"
assert dc.get_config("scratch_directory", hostname="dt5") is None

Expand Down

0 comments on commit fcb2a9e

Please sign in to comment.