-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(RHTAPWATCH-643): Adding python tests to CI
Signed-off-by: Yftach Herzog <[email protected]>
- Loading branch information
1 parent
233875f
commit 5c66517
Showing
11 changed files
with
294 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: tests | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
test: | ||
permissions: | ||
checks: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.11 | ||
- name: Install pipenv | ||
run: pip install pipenv==2023.7.23 | ||
- name: Create virtualenv | ||
run: pipenv sync | ||
- name: Run tests | ||
run: | | ||
pipenv run pytest tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
pytest = "*" | ||
black = "*" | ||
mypy = "*" | ||
pylint = "*" | ||
isort = "*" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.11" | ||
|
||
[scripts] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -ex | ||
|
||
main() { | ||
local pkgs=("tests" "compose_generator") | ||
pipenv run isort --profile black "${pkgs[@]}" | ||
pipenv run black "${pkgs[@]}" | ||
} | ||
|
||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then | ||
main "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Static checks""" | ||
from subprocess import run | ||
from typing import Final | ||
|
||
PKGS: Final[list[str]] = ["tests", "compose_generator"] | ||
|
||
|
||
def test_mypy() -> None: | ||
"""Static Type check""" | ||
run(["mypy"] + PKGS, check=True) | ||
|
||
|
||
def test_isort() -> None: | ||
"""Imports formatting check""" | ||
run(["isort", "--check", "--profile", "black"] + PKGS, check=True) | ||
|
||
|
||
def test_black() -> None: | ||
"""Formatting check""" | ||
run(["black", "--check"] + PKGS, check=True) | ||
|
||
|
||
def test_pylint() -> None: | ||
"""Lint check""" | ||
run(["pylint"] + PKGS, check=True) |