format check and lint resolved
This commit is contained in:
@@ -78,12 +78,14 @@ def _discover_schemes() -> dict[str, SchemeMeta]:
|
|||||||
|
|
||||||
if modes:
|
if modes:
|
||||||
vname = var_dir.name.capitalize()
|
vname = var_dir.name.capitalize()
|
||||||
variants.append(SchemeVariant(
|
variants.append(
|
||||||
id=var_dir.name,
|
SchemeVariant(
|
||||||
name=vname,
|
id=var_dir.name,
|
||||||
modes=frozenset(modes),
|
name=vname,
|
||||||
accents=tuple(sorted(accents)),
|
modes=frozenset(modes),
|
||||||
))
|
accents=tuple(sorted(accents)),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
schemes[sid] = SchemeMeta(
|
schemes[sid] = SchemeMeta(
|
||||||
id=sid,
|
id=sid,
|
||||||
@@ -118,8 +120,7 @@ def get_palette(scheme: str, variant: str, mode: str, accent: str | None = None)
|
|||||||
if not txt_path.exists():
|
if not txt_path.exists():
|
||||||
var_info = next(v for v in meta.variants if v.id == variant)
|
var_info = next(v for v in meta.variants if v.id == variant)
|
||||||
raise FileNotFoundError(
|
raise FileNotFoundError(
|
||||||
f"No {mode} palette for '{scheme}:{variant}'. "
|
f"No {mode} palette for '{scheme}:{variant}'. Available modes: {sorted(var_info.modes)}"
|
||||||
f"Available modes: {sorted(var_info.modes)}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
colors = _parse_txt(txt_path)
|
colors = _parse_txt(txt_path)
|
||||||
|
|||||||
@@ -12,39 +12,23 @@ def tmp_schemes(tmp_path: Path) -> Path:
|
|||||||
|
|
||||||
gmedium = schemes / "gruvbox" / "medium"
|
gmedium = schemes / "gruvbox" / "medium"
|
||||||
gmedium.mkdir(parents=True)
|
gmedium.mkdir(parents=True)
|
||||||
(gmedium / "dark.txt").write_text(
|
(gmedium / "dark.txt").write_text("background 101415\nonBackground e0e3e4\nprimary 81d3e0\nsurface 1c2021\n")
|
||||||
"background 101415\nonBackground e0e3e4\nprimary 81d3e0\nsurface 1c2021\n"
|
(gmedium / "light.txt").write_text("background fbf1c7\nonBackground 3c3836\nprimary 6b5f10\nsurface fbf1c7\n")
|
||||||
)
|
|
||||||
(gmedium / "light.txt").write_text(
|
|
||||||
"background fbf1c7\nonBackground 3c3836\nprimary 6b5f10\nsurface fbf1c7\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
ghard = schemes / "gruvbox" / "hard"
|
ghard = schemes / "gruvbox" / "hard"
|
||||||
ghard.mkdir(parents=True)
|
ghard.mkdir(parents=True)
|
||||||
(ghard / "dark.txt").write_text(
|
(ghard / "dark.txt").write_text("background 0b0d0e\nprimary 81d3e0\n")
|
||||||
"background 0b0d0e\nprimary 81d3e0\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
cmocha = schemes / "catppuccin" / "mocha"
|
cmocha = schemes / "catppuccin" / "mocha"
|
||||||
cmocha.mkdir(parents=True)
|
cmocha.mkdir(parents=True)
|
||||||
(cmocha / "dark.txt").write_text(
|
(cmocha / "dark.txt").write_text("background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n")
|
||||||
"background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n"
|
(cmocha / "mauve-dark.txt").write_text("background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n")
|
||||||
)
|
(cmocha / "green-dark.txt").write_text("background 1e1e2e\nprimary a6e3a1\nsecondary 5b8964\nsurface 313244\n")
|
||||||
(cmocha / "mauve-dark.txt").write_text(
|
|
||||||
"background 1e1e2e\nprimary cba6f7\nsecondary 756294\nsurface 313244\n"
|
|
||||||
)
|
|
||||||
(cmocha / "green-dark.txt").write_text(
|
|
||||||
"background 1e1e2e\nprimary a6e3a1\nsecondary 5b8964\nsurface 313244\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
clatte = schemes / "catppuccin" / "latte"
|
clatte = schemes / "catppuccin" / "latte"
|
||||||
clatte.mkdir(parents=True)
|
clatte.mkdir(parents=True)
|
||||||
(clatte / "light.txt").write_text(
|
(clatte / "light.txt").write_text("background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n")
|
||||||
"background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n"
|
(clatte / "mauve-light.txt").write_text("background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n")
|
||||||
)
|
|
||||||
(clatte / "mauve-light.txt").write_text(
|
|
||||||
"background eff1f5\nprimary 8839ef\nsecondary c2b8d0\nsurface ccd0da\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
cextra = schemes / "extra" / "default"
|
cextra = schemes / "extra" / "default"
|
||||||
cextra.mkdir(parents=True)
|
cextra.mkdir(parents=True)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
|
||||||
from unittest.mock import patch, call
|
from unittest.mock import patch, call
|
||||||
from zshell.subcommands.shell import app
|
from zshell.subcommands.shell import app
|
||||||
|
|
||||||
|
|
||||||
def invoke(*args: str) -> None:
|
def invoke(*args: str) -> None:
|
||||||
from typer.testing import CliRunner
|
from typer.testing import CliRunner
|
||||||
|
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = runner.invoke(app, args)
|
result = runner.invoke(app, args)
|
||||||
if result.exit_code != 0:
|
if result.exit_code != 0:
|
||||||
@@ -51,18 +51,14 @@ class TestLock:
|
|||||||
@patch("zshell.subcommands.shell.subprocess.run")
|
@patch("zshell.subcommands.shell.subprocess.run")
|
||||||
def test_lock_runs_ipc_call_lock(self, mock_run):
|
def test_lock_runs_ipc_call_lock(self, mock_run):
|
||||||
invoke("lock")
|
invoke("lock")
|
||||||
mock_run.assert_called_once_with(
|
mock_run.assert_called_once_with(["qs", "-c", "zshell", "ipc", "call", "lock", "lock"], check=True)
|
||||||
["qs", "-c", "zshell", "ipc", "call", "lock", "lock"], check=True
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestCall:
|
class TestCall:
|
||||||
@patch("zshell.subcommands.shell.subprocess.run")
|
@patch("zshell.subcommands.shell.subprocess.run")
|
||||||
def test_call_no_args(self, mock_run):
|
def test_call_no_args(self, mock_run):
|
||||||
invoke("call", "target", "method")
|
invoke("call", "target", "method")
|
||||||
mock_run.assert_called_once_with(
|
mock_run.assert_called_once_with(["qs", "-c", "zshell", "ipc", "call", "target", "method"], check=True)
|
||||||
["qs", "-c", "zshell", "ipc", "call", "target", "method"], check=True
|
|
||||||
)
|
|
||||||
|
|
||||||
@patch("zshell.subcommands.shell.subprocess.run")
|
@patch("zshell.subcommands.shell.subprocess.run")
|
||||||
def test_call_with_args(self, mock_run):
|
def test_call_with_args(self, mock_run):
|
||||||
|
|||||||
Reference in New Issue
Block a user