Skip to content

Commit

Permalink
test: command line interface (#63)
Browse files Browse the repository at this point in the history
Closes #1.

### Summary of Changes

Test the command line interface with `pytest`.

---------

Co-authored-by: lars-reimann <[email protected]>
  • Loading branch information
lars-reimann and lars-reimann authored Mar 19, 2023
1 parent defcc93 commit 0062000
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
Empty file.
Empty file.
95 changes: 95 additions & 0 deletions tests/library_analyzer/cli/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import subprocess


def test_cli_api() -> None:
subprocess.run(
[
"poetry",
"run",
"analyze-library",
"api",
"-p",
"library_analyzer",
"-s",
"src",
"-o",
"out",
],
check=True,
)


def test_cli_usages() -> None:
subprocess.run(
[
"poetry",
"run",
"analyze-library",
"usages",
"-p",
"library_analyzer",
"-c",
"library_analyzer",
"-o",
"out",
],
check=True,
)


def test_cli_annotations() -> None:
subprocess.run(
[
"poetry",
"run",
"analyze-library",
"annotations",
"-a",
"tests/data/removeAnnotations/api_data.json",
"-u",
"tests/data/removeAnnotations/usage_data.json",
"-o",
"out/annotations.json",
],
check=True,
)


def test_cli_all() -> None:
subprocess.run(
[
"poetry",
"run",
"analyze-library",
"all",
"-p",
"library_analyzer",
"-s",
"src",
"-c",
"library_analyzer",
"-o",
"out",
],
check=True,
)


def test_cli_migration() -> None:
subprocess.run(
[
"poetry",
"run",
"analyze-library",
"migrate",
"-a1",
"tests/data/migration/apiv1_data.json",
"-a2",
"tests/data/migration/apiv2_data.json",
"-a",
"tests/data/migration/annotationv1.json",
"-o",
"out",
],
check=True,
)

0 comments on commit 0062000

Please sign in to comment.