Skip to content
Snippets Groups Projects
Commit a4721854 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

add tests for root_dir

parent 15e436de
No related branches found
No related tags found
1 merge request!89Implement the init command
Pipeline #374373 passed
......@@ -539,6 +539,28 @@ def test_initialize_environment(tmp_path):
assert pytest_wrapped_e.value.code == 1
def test_get_root_dir(tmp_path):
"""Test that the root directory is correct."""
with mod.os_chdir(tmp_path):
# test that function exists with error 1 if root dir doesn't exist
with pytest.raises(SystemExit) as pytest_wrapped_e:
mod.get_root_dir()
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
# test that initialize_environment creates the root dir
mod.initialize_environment(tmp_path)
root_dir = mod.get_root_dir()
assert root_dir == tmp_path
# test that root_dir from paret is detected correctly
sub_dir = tmp_path / "sub_dir"
sub_dir.mkdir()
with mod.os_chdir(sub_dir):
root_dir = mod.get_root_dir()
assert root_dir == tmp_path
def test_interface(tmp_path):
"""Test other things (not implemented yet)."""
pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment