Skip to content

Commit

Permalink
test: add basic cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdaemon committed May 12, 2024
1 parent 6e74616 commit 40588c9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,19 @@ enable_error_code = [
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--doctest-modules"
testpaths = ["polymatch", "tests"]
filterwarnings = ["error"]
testpaths = ["src", "tests"]
filterwarnings = [
"error",
"ignore:defusedxml.lxml .*:DeprecationWarning:",
]

[tool.coverage.run]
source_pkgs = ["gvm_sync_targets", "tests"]
branch = true
parallel = true
relative_files = true
omit = [
"src/gvm_sync_targets/__about__.py",
"src/gvm_sync_targets/_version.py",
]

[tool.coverage.paths]
Expand Down
3 changes: 3 additions & 0 deletions tests/gvm_sync_targets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2024-present linuxdaemon <linuxdaemon.irc@gmail.com>
#
# SPDX-License-Identifier: MIT
17 changes: 17 additions & 0 deletions tests/gvm_sync_targets/cli_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2024-present linuxdaemon <linuxdaemon.irc@gmail.com>
#
# SPDX-License-Identifier: MIT
from click.testing import CliRunner

import gvm_sync_targets
from gvm_sync_targets import cli


def test_gvm_sync_targets() -> None:
runner = CliRunner()
result = runner.invoke(cli.gvm_sync_targets, ["--version"])
assert result.exit_code == 0
assert (
result.output
== f"gvm-sync-targets, version {gvm_sync_targets.version}\n"
)

0 comments on commit 40588c9

Please sign in to comment.