Add test condition for every dir possible
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
@@ -18,7 +18,7 @@ def test_no_base_dir(tmp_path: PosixPath):
|
||||
x = tmp_path.joinpath("nonexistent")
|
||||
X = RepoDirStructure(x)
|
||||
with pytest.raises(DirNotFoundError) as excinfo:
|
||||
X.exists
|
||||
X.base_dir_exists
|
||||
assert "DirNotFoundError: Directory does not exist / is not a dir: " in excinfo.exconly()
|
||||
assert excinfo.exconly().endswith("/nonexistent")
|
||||
|
||||
@@ -26,7 +26,7 @@ def test_no_base_dir(tmp_path: PosixPath):
|
||||
def test_no_config(tmp_path: PosixPath):
|
||||
X = RepoDirStructure(tmp_path)
|
||||
with pytest.raises(DirNotFoundError) as excinfo:
|
||||
X.exists
|
||||
X.conf_dir_exists
|
||||
assert "DirNotFoundError: Directory does not exist / is not a dir: " in excinfo.exconly()
|
||||
assert excinfo.exconly().endswith("/config")
|
||||
|
||||
@@ -35,7 +35,7 @@ def test_no_cache(tmp_path: PosixPath):
|
||||
tmp_path.joinpath("config").mkdir()
|
||||
X = RepoDirStructure(tmp_path)
|
||||
with pytest.raises(DirNotFoundError) as excinfo:
|
||||
X.exists
|
||||
X.cache_dir_exists
|
||||
assert "DirNotFoundError: Directory does not exist / is not a dir: " in excinfo.exconly()
|
||||
assert excinfo.exconly().endswith("/cache")
|
||||
|
||||
@@ -45,17 +45,22 @@ def test_no_repos(tmp_path: PosixPath):
|
||||
tmp_path.joinpath("cache").mkdir()
|
||||
X = RepoDirStructure(tmp_path)
|
||||
with pytest.raises(DirNotFoundError) as excinfo:
|
||||
X.exists
|
||||
X.repos_dir_exists
|
||||
assert "DirNotFoundError: Directory does not exist / is not a dir: " in excinfo.exconly()
|
||||
assert excinfo.exconly().endswith("/repos")
|
||||
|
||||
|
||||
def test_exists_okay(tmp_path: PosixPath):
|
||||
def test_dirs_exist_okay(tmp_path: PosixPath):
|
||||
tmp_path.joinpath("config").mkdir()
|
||||
tmp_path.joinpath("cache").mkdir()
|
||||
tmp_path.joinpath("repos").mkdir()
|
||||
|
||||
X = RepoDirStructure(tmp_path)
|
||||
assert True == X.exists
|
||||
assert X.base_dir_exists
|
||||
assert X.conf_dir_exists
|
||||
assert X.cache_dir_exists
|
||||
assert X.repos_dir_exists
|
||||
assert X.dirs_exist
|
||||
|
||||
|
||||
def test_base_dir():
|
||||
|
||||
Reference in New Issue
Block a user