Skip to content

Commit 84f9ce0

Browse files
committed
[Testing] Fix up current tests for future work
These tests were not updated and are failing. RLC rebase will be expanding test coverage but these needed fixed.
1 parent c7abb48 commit 84f9ce0

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/pr_check.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ jobs:
3636
run: |
3737
pre-commit install
3838
pre-commit run --all-files --show-diff-on-failure --verbose --color=always
39+
40+
- name: Test
41+
run: |
42+
pytest

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ include = ["kt*"]
4343

4444
[project.scripts]
4545
kt = "kt.kt:main"
46+
47+
[tool.pytest.ini_options]
48+
testpaths = ["tests"]
49+
addopts = "-ra -q"

tests/kt/ktlib/test_config.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
'"kernels_dir": "~/ciq/kernels",'
1111
'"images_source_dir": "~/ciq/default_test_images",'
1212
'"images_dir": "~/ciq/tmp/virt-images",'
13-
'"ssh_key": "~/ciq/id_ed25519_generic.pub"'
13+
'"ssh_key": "~/ciq/id_ed25519_generic.pub",'
14+
'"user": "testuser"'
1415
"}"
1516
)
1617

1718

18-
def test_config_load_default_fallback():
19+
def test_config_load_default_fallback(monkeypatch):
20+
# Remove the environment variable if it exists when running local tests
21+
monkeypatch.delenv("KTOOLS_CONFIG_FILE", raising=False)
1922
config = Config.load()
2023
assert config.base_path == DEFAULT_CONFIG["base_path"]
2124

@@ -47,7 +50,7 @@ def test_config_load_from_json_data_None():
4750
def test_config_load_from_json_data_empty():
4851
json_data = "{}"
4952

50-
with pytest.raises(TypeError, match="missing 5 required positional arguments:"):
53+
with pytest.raises(TypeError, match="missing 6 required positional arguments:"):
5154
config = Config.from_json(json_data) # noqa F841
5255

5356

@@ -74,3 +77,8 @@ def test_config_load_from_json_proper_images_dir():
7477
def test_config_load_from_json_proper_ssh_key():
7578
config = Config.from_json(CONFIG_STR)
7679
assert config.ssh_key == Path("~/ciq/id_ed25519_generic.pub").expanduser()
80+
81+
82+
def test_config_load_from_json_proper_user():
83+
config = Config.from_json(CONFIG_STR)
84+
assert config.user == "testuser"

tests/kt/ktlib/test_kernels.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"src_tree_branch": "src-branch",
1313
"dist_git_root": "dist-git-tree-cbr",
1414
"dist_git_branch": "dist-branch",
15+
"mock_config": "test-mock-config",
16+
"automated": True,
1517
}
1618
}
1719

0 commit comments

Comments
 (0)