Skip to content

Commit 62704b0

Browse files
authored
test script (#893)
1 parent 6382f6a commit 62704b0

39 files changed

+5023
-4866
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Test
33

44
on:
55
pull_request:
6-
types: [opened, edited, ready_for_review, synchronize]
6+
types: [opened, ready_for_review, synchronize]
77
push:
88
branches:
99
- main
@@ -52,6 +52,9 @@ jobs:
5252
- name: Check out the code
5353
uses: actions/checkout@v5
5454

55+
- name: Fetch full main branch history # We don't known the the base commit of the PR
56+
run: git fetch origin main --unshallow
57+
5558
# Setup Python (faster than using Python container)
5659
- name: Setup Python
5760
uses: actions/setup-python@v6
@@ -79,8 +82,14 @@ jobs:
7982
path: .pytest_cache
8083
key: pytest_cache-${{ github.head_ref }}
8184

82-
- name: Run unit tests with Postgresql
83-
run: python -m pytest --cov
85+
# Run unit tests, run them all when push to main branch
86+
- name: Run all unit tests
87+
run: python tests_script.py --cov --all
88+
if: github.event_name == 'push'
89+
90+
- name: Run unit tests for changed files
91+
run: python tests_script.py --cov
92+
if: github.event_name == 'pull_request'
8493

8594
- name: Upload coverage reports to Codecov
8695
uses: codecov/[email protected]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/test_payment.py renamed to tests/core/test_payment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ async def test_webhook_payment_callback(
296296
) -> None:
297297
# We patch the callback to be able to check if it was called
298298
mocked_callback = mocker.patch(
299-
"tests.test_payment.callback",
299+
"tests.core.test_payment.callback",
300300
)
301301

302302
# We patch the module_list to inject our custom test module
@@ -337,7 +337,7 @@ async def test_webhook_payment_callback_fail(
337337
) -> None:
338338
# We patch the callback to be able to check if it was called
339339
mocked_callback = mocker.patch(
340-
"tests.test_payment.callback",
340+
"tests.core.test_payment.callback",
341341
side_effect=ValueError("Test error"),
342342
)
343343

0 commit comments

Comments
 (0)