Skip to content

Commit 2c642a4

Browse files
authored
Merge pull request #366 from matchID-project/codex/ajouter-tests-avec-pytest-yqynwr
Integrate tests into docker workflows
2 parents 5a7866b + 1706c7f commit 2c642a4

File tree

8 files changed

+425
-3
lines changed

8 files changed

+425
-3
lines changed

.github/workflows/pull.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414
id: extract_branch
1515
- name: build
1616
if: success()
17-
run: make version backend-docker-check GIT_BRANCH=$GIT_BRANCH || ( make backend-build GIT_BRANCH=$GIT_BRANCH && make backend backend-stop GIT_BRANCH=$GIT_BRANCH)
17+
run: make version backend-docker-check GIT_BRANCH=$GIT_BRANCH || ( make backend-build GIT_BRANCH=$GIT_BRANCH && make backend GIT_BRANCH=$GIT_BRANCH)
18+
env:
19+
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }}
20+
- name: tests
21+
if: success()
22+
run: make tests backend-stop GIT_BRANCH=$GIT_BRANCH
1823
env:
1924
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }}

.github/workflows/push.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
run: make version backend-docker-check GIT_BRANCH=$GIT_BRANCH || ( make backend-build GIT_BRANCH=$GIT_BRANCH && make backend backend-stop GIT_BRANCH=$GIT_BRANCH)
2222
env:
2323
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }}
24+
- name: tests
25+
if: success()
26+
run: make tests
27+
env:
28+
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }}
2429
- name: publish
2530
if: success()
2631
run: |

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN mkdir -p code\
2323
conf/run\
2424
log\
2525
referential_data\
26-
matchID_test/\
26+
tests\
2727
upload
2828

2929
################################
@@ -41,11 +41,13 @@ WORKDIR /${APP}
4141
COPY code/ code/
4242
COPY conf/ conf/
4343
COPY referential_data/ referential_data/
44+
COPY tests/ tests/
4445

4546
VOLUME /${app_path}/projects
4647
VOLUME /${app_path}/log
4748
VOLUME /${app_path}/models
4849
VOLUME /${app_path}/upload
50+
VOLUME /${app_path}/tests
4951

5052
EXPOSE ${BACKEND_PORT}
5153

@@ -68,6 +70,7 @@ VOLUME /${APP}/referential_data
6870
VOLUME /${APP}/log
6971
VOLUME /${APP}/models
7072
VOLUME /${APP}/upload
73+
VOLUME /${APP}/tests
7174

7275
EXPOSE ${BACKEND_PORT}
7376

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export GITHUB_OAUTH_SECRET=203010f81158d3ceab0297a213e80bc0fbfe7f8e
3636
export BACKEND := $(shell pwd)
3737
export UPLOAD=${BACKEND}/upload
3838
export PROJECTS=${BACKEND}/projects
39+
export TESTS=${BACKEND}/tests
3940
export EXAMPLES=${BACKEND}/../examples
4041
export TUTORIAL=${BACKEND}/../tutorial
4142
export MODELS=${BACKEND}/models
@@ -696,3 +697,8 @@ deploy-remote: config deploy-remote-instance deploy-remote-services deploy-remot
696697

697698
clean-remote:
698699
@make -C ${APP_PATH}/${GIT_TOOLS} remote-clean ${MAKEOVERRIDES} > /dev/null 2>&1 || true
700+
701+
tests:
702+
@docker exec -i ${USE_TTY} ${DC_PREFIX}-${APP} pytest -q -W "ignore::DeprecationWarning" -W "ignore::FutureWarning"
703+
704+
.PHONY: tests

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,14 @@ If you want to contribute to the developpement, you'll be able to fork the repo
128128
```
129129
make start-dev
130130
```
131+
132+
### Running tests
133+
Install dependencies and run tests with Make:
134+
```bash
135+
make tests
136+
```
137+
You can also install the requirements and run pytest directly:
138+
```bash
139+
pip install -r requirements.txt
140+
pytest
141+
```

docker-compose-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ services:
88
- ${BACKEND}/code/:/${APP_GROUP}/code/
99
- ${BACKEND}/referential_data/:/${APP_GROUP}/referential_data/
1010
- ${BACKEND}/conf/:/${APP_GROUP}/conf/
11+
- ${BACKEND}/tests/:/${APP_GROUP}/tests/

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ typing
2525
Werkzeug==3.0.3
2626
rsa>=4.7 # not directly required, pinned by Snyk to avoid a vulnerability
2727
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability
28-
pyarrow>=14.0.1
28+
pyarrow>=14.0.1
29+
pytest

0 commit comments

Comments
 (0)