diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b81f8c8..6bd8420 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,6 +31,8 @@ repos: rev: 1.7.10 hooks: - id: bandit + args: [-c, pyproject.toml] + additional_dependencies: ['bandit[toml]'] - repo: https://github.com/PyCQA/isort rev: 5.13.2 hooks: @@ -45,3 +47,11 @@ repos: hooks: - id: remove-crlf - id: remove-tabs + - repo: local + hooks: + - id: pytest-check + name: pytest-check + entry: pytest + language: system + pass_filenames: false + always_run: true diff --git a/README.md b/README.md index a488aa9..52ade0f 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,9 @@ source env/bin/activate pip3 install ".[dev]" pre-commit install ``` + +Run tests + +```bash +pytest -svv +``` diff --git a/pyproject.toml b/pyproject.toml index ff78742..97e851d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,4 +13,8 @@ description = "config generator for joj3" readme = "README.md" [project.optional-dependencies] -dev = ["pre-commit>=3.7.1", "black>=24.4.2"] +dev = ["pre-commit>=3.7.1", "black>=24.4.2", "pytest>=8.3.3"] + +[tool.bandit] +exclude_dirs = ["tests"] +skips = ["B101"] diff --git a/tests/example_test.py b/tests/example_test.py new file mode 100644 index 0000000..c2df768 --- /dev/null +++ b/tests/example_test.py @@ -0,0 +1,12 @@ +# from xxx import generate + + +from typing import Any + + +def test_generate() -> None: + generate = lambda x: x # TODO: real generate function imported + data_input: dict[Any, Any] = {} # TODO: load real input from some file + data_output: dict[Any, Any] = generate(data_input) + expected_output: dict[Any, Any] = {} # TODO: load real output from some file + assert data_output == expected_output