-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use human sorting for job names (#39)
* Use human sorting for job names * Refactor testing
- Loading branch information
Showing
7 changed files
with
146 additions
and
24 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 |
---|---|---|
|
@@ -13,3 +13,4 @@ minmax | |
mkdocs | ||
pyenv | ||
ssbarnea | ||
pypa |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"python.formatting.provider": "black" | ||
"python.formatting.provider": "black", | ||
"editor.defaultFormatter": "charliermarsh.ruff", | ||
"editor.formatOnSave": true | ||
} |
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 |
---|---|---|
|
@@ -10,4 +10,5 @@ dictionaries: | |
- words | ||
- python | ||
ignorePaths: | ||
- .vscode/settings.json | ||
- cspell.config.yaml |
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 |
---|---|---|
@@ -1,9 +1,75 @@ | ||
"""Tests for github action.""" | ||
|
||
import json | ||
import os | ||
import sys | ||
import tempfile | ||
from subprocess import run | ||
|
||
import pytest | ||
|
||
def test_foo() -> None: | ||
|
||
@pytest.mark.parametrize( | ||
("passed_env", "expected"), | ||
[ | ||
pytest.param( | ||
{ | ||
"INPUT_DEFAULT_PYTHON": "3.8", | ||
"INPUT_LINUX": "full", | ||
"INPUT_MACOS": "minmax", | ||
"INPUT_MAX_PYTHON": "3.8", | ||
"INPUT_MIN_PYTHON": "3.8", | ||
"INPUT_OTHER_NAMES": "z\nall-linux-arm64:tox -e unit;tox -e integration", | ||
"INPUT_PLATFORMS": "linux-arm64:ubuntu-24.04-arm64-2core", | ||
"INPUT_SKIP_EXPLODE": "1", | ||
"INPUT_WINDOWS": "minmax", | ||
}, | ||
{ | ||
"matrix": { | ||
"include": [ | ||
{ | ||
"command": "tox -e unit", | ||
"command2": "tox -e integration", | ||
"name": "all-linux-arm64", | ||
"os": "ubuntu-24.04-arm64-2core", | ||
"python_version": "3.8", | ||
}, | ||
{ | ||
"command": "tox -e z", | ||
"name": "z", | ||
"os": "ubuntu-24.04", | ||
"python_version": "3.8", | ||
}, | ||
], | ||
}, | ||
}, | ||
id="1", | ||
), | ||
], | ||
) | ||
def test_action(passed_env: dict[str, str], expected: dict[str, str]) -> None: | ||
"""Sample test.""" | ||
run([sys.executable, "entrypoint.py"], check=True, shell=False) # noqa: S603 | ||
with tempfile.NamedTemporaryFile(delete=False) as temp_file: | ||
env = { | ||
**os.environ.copy(), | ||
**passed_env, | ||
"TEST_GITHUB_OUTPUT_JSON": temp_file.name, | ||
} | ||
|
||
result = run( | ||
[sys.executable, "entrypoint.py"], | ||
text=True, | ||
shell=False, | ||
check=True, | ||
capture_output=True, | ||
env=env, | ||
) | ||
assert result.returncode == 0 | ||
temp_file.seek(0) | ||
effective = temp_file.read().decode("utf-8") | ||
data = json.loads(effective) | ||
assert isinstance(data, dict), data | ||
assert len(data) == 1 | ||
assert "matrix" in data | ||
assert data == expected | ||
# TestCase().assertDictEqual(data, expected) |