Skip to content

Commit

Permalink
Update workflow to check code format
Browse files Browse the repository at this point in the history
- Add code formatting check to the astarte-ctl-test workflow.
- Apply Black code formatting to the tests directory using the command
  `python -m black tests/`.

Signed-off-by: Osman Hadzic <[email protected]>
  • Loading branch information
osmanhadzic committed Nov 6, 2024
1 parent e6fab5b commit 8c6cf42
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/astarte-ctl-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ jobs:

- name: Install dependencies
shell: bash
run: pip install -e ./tests
run: pip install -e ./tests

- name: Format check
shell: bash
run: python -m black -l 100 --diff --check tests/

- name: Run tests
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_get_sample_data_for_nonexisting_device(astarte_env_vars):
assert "Device not found" in sample_data_result.stderr


def test_get_sample_data_for_nonexisting_interface(astarte_env_vars):
def test_get_sample_data_for_existing_device(astarte_env_vars):
device_id = astarte_env_vars["device_test_1"]
astarte_url = astarte_env_vars["astarte_url"]
realm = astarte_env_vars["realm"]
Expand Down
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ def astarte_env_vars():
astarte_url and realm and jwt
), "Environment variables for Astarte setup are not properly configured."

return {"astarte_url": astarte_url, "realm": realm, "jwt": jwt, "device_test_1": device_test_1}
return {
"astarte_url": astarte_url,
"realm": realm,
"jwt": jwt,
"device_test_1": device_test_1,
}
3 changes: 2 additions & 1 deletion tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ authors = [
]
dependencies = [
"pytest>=7.0.0",
"black>=23.1.0"
]
classifiers = [
"Programming Language :: Python",
Expand All @@ -24,7 +25,7 @@ classifiers = [
static = ["black", "pylint"]

[tool.black]
line-length = 88
line-length = 100
target-version = ["py312"]

[tool.isort]
Expand Down

0 comments on commit 8c6cf42

Please sign in to comment.