Merge pull request #420 from aclist/chore/update-tests
Mirror to Codeberg / mirror-to-codeberg (push) Waiting to run

chore: update tests
This commit is contained in:
aclist authored and GitHub committed 2026-07-27 20:22:43 +09:00
commit 3b4a736ce6
3 files changed
+12 -3

No files matched your search

+1
View File
@@ -109,6 +109,7 @@ config-settings-package = { pygobject-stubs = { config = "Gtk3,Gdk3,Soup2" } }
markers = [ markers = [
"apitest: checks remote endpoints", "apitest: checks remote endpoints",
"config: config file keys/values", "config: config file keys/values",
"realconfig: depends on actual generated local config file",
"mods: tests mod metadata/link creation", "mods: tests mod metadata/link creation",
"pefile: validate PE files", "pefile: validate PE files",
"post_install: requires a completed installation", "post_install: requires a completed installation",
+6 -2
View File
@@ -7,13 +7,12 @@ from dzgui.config.xdg import get_xdg_paths, parse_filepaths
from dzgui.config import convert from dzgui.config import convert
from tests.fixtures import fixture_path from tests.fixtures import fixture_path
pytestmark = pytest.mark.config
@pytest.fixture @pytest.fixture
def legacy_config(): def legacy_config():
return fixture_path("dztuirc_1") return fixture_path("dztuirc_1")
@pytest.fixture @pytest.fixture
def unset_values(): def unset_values():
return fixture_path("dztuirc_3") return fixture_path("dztuirc_3")
@@ -38,6 +37,7 @@ def keys():
# TODO: use a static fixture instead of system config # TODO: use a static fixture instead of system config
@pytest.fixture @pytest.fixture
@pytest.mark.realconfig
def config(): def config():
paths = get_xdg_paths() paths = get_xdg_paths()
xdg = parse_filepaths(paths) xdg = parse_filepaths(paths)
@@ -45,18 +45,21 @@ def config():
@pytest.mark.post_install @pytest.mark.post_install
@pytest.mark.realconfig
def test_invalid_config_value(config): def test_invalid_config_value(config):
with pytest.raises(Exception): with pytest.raises(Exception):
assert config["foo"] is None assert config["foo"] is None
@pytest.mark.post_install @pytest.mark.post_install
@pytest.mark.realconfig
def test_default_config_values(keys, config): def test_default_config_values(keys, config):
for key in keys: for key in keys:
assert config[key] is not None assert config[key] is not None
@pytest.mark.post_install @pytest.mark.post_install
@pytest.mark.realconfig
def test_contains_invalid_values(keys, config): def test_contains_invalid_values(keys, config):
for key in config: for key in config:
assert key in keys assert key in keys
@@ -91,6 +94,7 @@ def test_key_conversion(legacy_config):
for key in keys: for key in keys:
assert key not in j assert key not in j
def test_missing_values(unset_values): def test_missing_values(unset_values):
j = convert.rc2json(unset_values) j = convert.rc2json(unset_values)
j = json.loads(j) j = json.loads(j)
+5 -1
View File
@@ -13,13 +13,17 @@ def config():
xdg = parse_filepaths(paths) xdg = parse_filepaths(paths)
return get_config(xdg.config) return get_config(xdg.config)
def test_ipdb(): def test_ipdb():
assert probe.test_ipdb() assert probe.test_ipdb()
def test_steam(config): def test_steam(config):
key = config["steam_api"] key = config["steam_api"]
assert probe.test_steam_api(key) assert probe.test_steam_api(key)
def test_bm(config): def test_bm(config):
# NOTE: see ticket #417; expected to return False
key = config["bm_api"] key = config["bm_api"]
assert probe.test_bm_api(key) assert probe.test_bm_api(key) is False