diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ac32cd4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test + +on: + pull_request: + push: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: pip install pytest toml + - name: Run tests + run: pytest -v diff --git a/tests/test_configs.py b/tests/test_configs.py new file mode 100644 index 0000000..6de5892 --- /dev/null +++ b/tests/test_configs.py @@ -0,0 +1,18 @@ +import json +import pathlib + +try: + import tomllib # Python 3.11+ +except ModuleNotFoundError: # pragma: no cover - fallback for older versions + import toml as tomllib + + +def test_load_configs(): + repo_root = pathlib.Path(__file__).resolve().parents[1] + karabiner_path = repo_root / ".config" / "karabiner" / "karabiner.json" + with karabiner_path.open('r', encoding='utf-8') as f: + json.load(f) + + starship_path = repo_root / ".config" / "starship.toml" + with starship_path.open('rb') as f: + tomllib.load(f)