Skip to content

Commit

Permalink
pytest: Add simple functional pytest
Browse files Browse the repository at this point in the history
Signed-off-by: Arisu Tachibana <[email protected]>
  • Loading branch information
aliceinwire committed Sep 12, 2024
1 parent 3e74d19 commit 44067cf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ jobs:
run: poetry run black --check --verbose .
- name: Isort check
run: poetry run isort . --check --diff
- name: Pytest check
run: poetry run pytest -rP
38 changes: 38 additions & 0 deletions tests/test_kcidev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from subprocess import PIPE, run
import os

def test_prepare():
os.system("cp .kci-dev.toml.example .kci-dev.toml")
assert os.path.exists(".kci-dev.toml")

def test_kcidev_help():
command = ["poetry", "run", "kci-dev", "--help"]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print("returncode: " + str(result.returncode))
print("#### stdout ####")
print(result.stdout)
print("#### stderr ####")
print(result.stderr)
assert result.returncode == 0


def test_kcidev_commit_help():
command = ["poetry", "run", "kci-dev", "commit", "--help"]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print("returncode: " + str(result.returncode))
print("#### stdout ####")
print(result.stdout)
print("#### stderr ####")
print(result.stderr)
assert result.returncode == 0


def test_kcidev_patch_help():
command = ["poetry", "run", "kci-dev", "patch", "--help"]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print("returncode: " + str(result.returncode))
print("#### stdout ####")
print(result.stdout)
print("#### stderr ####")
print(result.stderr)
assert result.returncode == 0

0 comments on commit 44067cf

Please sign in to comment.