Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit536f74c

Browse files
committed
fix: Configure GitHub Actions for MongoDB testing
- Add MongoDB service container- Set test environment variables- Update test requirements- Add wait step for MongoDB
1 parentbb4c1b1 commit536f74c

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

‎.github/workflows/python-app.yml‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ permissions:
1010
contents:read
1111

1212
jobs:
13-
test:
13+
build:
1414
runs-on:ubuntu-latest
1515

16+
services:
17+
mongodb:
18+
image:mongo:4.4
19+
ports:
20+
-27017:27017
21+
1622
env:
1723
MONGODB_URI:mongodb://localhost:27017
1824
MONGODB_DATABASE:test_db
@@ -33,6 +39,11 @@ jobs:
3339
pip install -r requirements.txt
3440
pip install -r requirements-test.txt
3541
42+
-name:Wait for MongoDB
43+
run:|
44+
timeout 30 bash -c 'until nc -z localhost 27017; do sleep 1; done'
45+
sleep 5
46+
3647
-name:Run tests
3748
run:|
38-
python -m pytest tests/ -v --import-mode=importlib
49+
python -m pytest tests/ -v

‎requirements-test.txt‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
pytest==7.4.2
2-
pytest-mock==3.11.1
3-
pytest-cov==4.1.0
1+
pytest>=7.4.2
2+
pytest-mock>=3.11.1
3+
pytest-cov>=4.1.0
4+
coverage>=7.3.1
45
pymongo==4.5.0
56
python-dotenv==1.0.0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp