-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5377baa
commit 077bab4
Showing
7 changed files
with
60 additions
and
3 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
m/.m | ||
.mypy_cache | ||
__pycache__ | ||
.coverage |
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 |
---|---|---|
|
@@ -3,3 +3,6 @@ mypy: | |
|
||
action: | ||
m github actions src/pkg/actions.py | ||
|
||
tests: | ||
./src/tests/run.sh |
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,4 @@ | ||
from m.testing import block_m_side_effects, block_network_access | ||
|
||
block_m_side_effects() | ||
block_network_access() |
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,20 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
export DEBUG_HTTP_INCLUDE_BODY=1 | ||
|
||
SINGLE=true | ||
SINGLE=false | ||
|
||
pyPath="src" | ||
baseSrc="src/pkg" | ||
if [ "$SINGLE" = 'false' ]; then | ||
coverage run --source "$baseSrc" -m pytest -p no:logging | ||
coverage report -m --fail-under 98 | ||
else | ||
# To run specific tests: | ||
filter="test_testing" | ||
source="$baseSrc" | ||
coverage run --source "$source" -m pytest -p no:logging "$pyPath" -vv -k "$filter" | ||
coverage report -m | ||
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,29 @@ | ||
import pytest | ||
from m.github.actions import Action | ||
from m.testing import ActionStepTestCase as TCase | ||
from m.testing import run_action_test_case | ||
from pytest_mock import MockerFixture | ||
|
||
from pkg.actions import actions | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'tcase', | ||
[ | ||
TCase( | ||
name='square_number', | ||
py_file=f'src/pkg/main.py', | ||
inputs={'INPUT_NUM': '4'}, | ||
expected_stdout='Squaring the number\n', | ||
outputs=['squared-num=16'], | ||
), | ||
], | ||
ids=lambda tcase: tcase.name, | ||
) | ||
def test_m_gh_actions_api(tcase: TCase, mocker: MockerFixture) -> None: | ||
run_action_test_case(mocker, tcase) | ||
|
||
|
||
def test_actions_instance() -> None: | ||
assert isinstance(actions, Action) | ||
assert actions.name == 'Square Number' |