diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3c775ec..660005c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,6 +34,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.py }} + - name: Fetch Bats submodules + if: "${{ matrix.py == '3.12' }}" + run: git submodule update - name: Install tox run: python -m pip install tox-gh>=1.2 - name: Setup test suite diff --git a/pyproject.toml b/pyproject.toml index 019db93..b8d89f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ universal = true [tool.ruff] line-length = 80 +extend-exclude = ["tests/cli/"] [tool.ruff.lint] # Enable Errors, Warnings, Flakes diff --git a/tests/cli/test.bats b/tests/cli/test.bats new file mode 100644 index 0000000..621cc34 --- /dev/null +++ b/tests/cli/test.bats @@ -0,0 +1,14 @@ +setup() { + load 'test_helper/bats-support/load' + load 'test_helper/bats-assert/load' +} + +@test "can run" { + run gcalcli + assert_output --regexp '^usage: .*error:.*required: command\b' +} + +@test "prints correct help" { + run gcalcli -h + assert_output --regexp 'positional arguments:.*list.*search.*edit.*options:' +} diff --git a/tox.ini b/tox.ini index 81ec924..77c913c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] requires = tox>=4 -envlist = lint, type, py3{8,9,10,11,12} +envlist = lint, type, py3{8,9,10,11,12}, cli [testenv] usedevelop=true @@ -31,9 +31,16 @@ deps = commands = mypy {posargs:gcalcli} +[testenv:cli] +description = run functional tests using Bats +allowlist_externals = + ./tests/cli/bats/bin/bats +commands = + ./tests/cli/bats/bin/bats tests/cli/test.bats + [gh] python = - 3.12 = py312, lint, type + 3.12 = py312, lint, type, cli 3.11 = py311 3.10 = py310 3.9 = py39