Skip to content

Commit 3f80367

Browse files
Laure-diremyleone
andauthored
test: migrate from unittest to pytest, add VCR, and set up nightly test workflow (#1169)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
1 parent 2bb6ec0 commit 3f80367

35 files changed

+4382
-241
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ jobs:
4141
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
4242
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
4343
SCW_DEFAULT_REGION: ${{ secrets.SCW_DEFAULT_REGION }}
44-
run: poetry run python -m unittest discover -s tests -v
44+
REPLAY_CASSETTES: true
45+
run: poetry run pytest -v
4546

.github/workflows/nightly.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Nightly Tests
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *'
5+
6+
permissions:
7+
actions: read
8+
9+
jobs:
10+
nightly:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python: [ '3.10' ,'3.11', '3.12', '3.13' ]
15+
products:
16+
- instance
17+
- k8s
18+
- vpc
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Setup Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python }}
26+
cache: "poetry"
27+
- name: Install dependencies and library
28+
run: poetry install
29+
- name: Run Tests
30+
run: poetry run pytest -v ./internal/namespaces/${{ matrix.products }}/tests/... -timeout=4h
31+
env:
32+
PYTHON_UPDATE_CASSETTES: true
33+
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
34+
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
35+
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
36+
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
37+
- name: Ping on failure
38+
if: ${{ failure() }}
39+
run: |
40+
curl -X POST -H 'Content-type: application/json' \
41+
--data '{
42+
"blocks": [
43+
{
44+
"type": "section",
45+
"text": {
46+
"type": "mrkdwn",
47+
"text": "'"Scaleway SDK Python Nightly workflow failed: <https://github.com/scaleway/scaleway-sdk-python/actions/runs/${GITHUB_RUN_ID}|${FAILED_PRODUCT}>"'"
48+
}
49+
}
50+
]
51+
}' \
52+
${SLACK_WEBHOOK_NIGHTLY};
53+
env:
54+
SLACK_WEBHOOK_NIGHTLY: ${{ secrets.SLACK_WEBHOOK_NIGHTLY }}
55+
FAILED_PRODUCT: "${{ matrix.products }}"

scaleway-async/poetry.lock

Lines changed: 114 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scaleway-async/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ruff = ">=0.5.0,<0.12.9"
3232
mypy = "^1.5.1"
3333
ty = "^0.0.1a15"
3434
pyrefly = ">=0.24.2,<0.27.0"
35+
pytest = "^8.4.1"
3536

3637
[build-system]
3738
requires = ["poetry-core"]

scaleway-core/poetry.lock

Lines changed: 112 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scaleway-core/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ruff = ">=0.5.0,<0.12.8"
3434
mypy = "^1.5.1"
3535
ty = "^0.0.1a15"
3636
pyrefly = ">=0.24.2,<0.27.0"
37+
pytest = "^8.4.1"
3738

3839
[build-system]
3940
requires = ["poetry-core"]

0 commit comments

Comments
 (0)