marintosti12 commited on
Commit
747ec2f
·
1 Parent(s): 2a3c0e5

fix(test) correction d'un test de base pour la route /

Browse files
Files changed (4) hide show
  1. .github/workflows/ci.yaml +1 -0
  2. poetry.lock +59 -1
  3. pyproject.toml +6 -1
  4. tests/test_main.py +10 -0
.github/workflows/ci.yaml CHANGED
@@ -42,6 +42,7 @@ jobs:
42
  - name: Install deps (no dev)
43
  run: poetry install --no-interaction --no-ansi
44
 
 
45
  - name: Lint (ruff)
46
  run: |
47
  poetry run python -m pip install ruff
 
42
  - name: Install deps (no dev)
43
  run: poetry install --no-interaction --no-ansi
44
 
45
+ # Ruff est un linter et formateur de code Python
46
  - name: Lint (ruff)
47
  run: |
48
  poetry run python -m pip install ruff
poetry.lock CHANGED
@@ -297,6 +297,17 @@ files = [
297
  [package.extras]
298
  all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
299
 
 
 
 
 
 
 
 
 
 
 
 
300
  [[package]]
301
  name = "jinja2"
302
  version = "3.1.6"
@@ -418,6 +429,32 @@ files = [
418
  {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
419
  ]
420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  [[package]]
422
  name = "pydantic"
423
  version = "2.11.7"
@@ -565,6 +602,27 @@ files = [
565
  [package.extras]
566
  windows-terminal = ["colorama (>=0.4.6)"]
567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  [[package]]
569
  name = "python-dotenv"
570
  version = "1.1.1"
@@ -1277,4 +1335,4 @@ files = [
1277
  [metadata]
1278
  lock-version = "2.0"
1279
  python-versions = "^3.12"
1280
- content-hash = "88ee0e0f68ec43cd0c2252d0397b9af4776345ce95db3cee571d8de7657d3223"
 
297
  [package.extras]
298
  all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
299
 
300
+ [[package]]
301
+ name = "iniconfig"
302
+ version = "2.1.0"
303
+ description = "brain-dead simple config-ini parsing"
304
+ optional = false
305
+ python-versions = ">=3.8"
306
+ files = [
307
+ {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"},
308
+ {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"},
309
+ ]
310
+
311
  [[package]]
312
  name = "jinja2"
313
  version = "3.1.6"
 
429
  {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
430
  ]
431
 
432
+ [[package]]
433
+ name = "packaging"
434
+ version = "25.0"
435
+ description = "Core utilities for Python packages"
436
+ optional = false
437
+ python-versions = ">=3.8"
438
+ files = [
439
+ {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"},
440
+ {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"},
441
+ ]
442
+
443
+ [[package]]
444
+ name = "pluggy"
445
+ version = "1.6.0"
446
+ description = "plugin and hook calling mechanisms for python"
447
+ optional = false
448
+ python-versions = ">=3.9"
449
+ files = [
450
+ {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"},
451
+ {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"},
452
+ ]
453
+
454
+ [package.extras]
455
+ dev = ["pre-commit", "tox"]
456
+ testing = ["coverage", "pytest", "pytest-benchmark"]
457
+
458
  [[package]]
459
  name = "pydantic"
460
  version = "2.11.7"
 
602
  [package.extras]
603
  windows-terminal = ["colorama (>=0.4.6)"]
604
 
605
+ [[package]]
606
+ name = "pytest"
607
+ version = "8.4.2"
608
+ description = "pytest: simple powerful testing with Python"
609
+ optional = false
610
+ python-versions = ">=3.9"
611
+ files = [
612
+ {file = "pytest-8.4.2-py3-none-any.whl", hash = "sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79"},
613
+ {file = "pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01"},
614
+ ]
615
+
616
+ [package.dependencies]
617
+ colorama = {version = ">=0.4", markers = "sys_platform == \"win32\""}
618
+ iniconfig = ">=1"
619
+ packaging = ">=20"
620
+ pluggy = ">=1.5,<2"
621
+ pygments = ">=2.7.2"
622
+
623
+ [package.extras]
624
+ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "requests", "setuptools", "xmlschema"]
625
+
626
  [[package]]
627
  name = "python-dotenv"
628
  version = "1.1.1"
 
1335
  [metadata]
1336
  lock-version = "2.0"
1337
  python-versions = "^3.12"
1338
+ content-hash = "580759ab66b1cc8c955c9ec7c9746b75c87ef02ba29d6658125352b63f6ae54a"
pyproject.toml CHANGED
@@ -13,6 +13,7 @@ uvicorn = "^0.35.0"
13
 
14
  [tool.poetry.group.dev.dependencies]
15
  ruff = "^0.12.12"
 
16
 
17
  [build-system]
18
  requires = ["poetry-core"]
@@ -23,4 +24,8 @@ target-version = "py312"
23
  line-length = 100
24
  extend-exclude = [
25
  "notebook/*.ipynb",
26
- ]
 
 
 
 
 
13
 
14
  [tool.poetry.group.dev.dependencies]
15
  ruff = "^0.12.12"
16
+ pytest = "^8.4.2"
17
 
18
  [build-system]
19
  requires = ["poetry-core"]
 
24
  line-length = 100
25
  extend-exclude = [
26
  "notebook/*.ipynb",
27
+ ]
28
+
29
+ [tool.pytest.ini_options]
30
+ testpaths = ["tests"]
31
+ pythonpath = ["src"]
tests/test_main.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi.testclient import TestClient
2
+
3
+ from main import app
4
+
5
+ client = TestClient(app)
6
+
7
+ def test_root_ok():
8
+ r = client.get("/")
9
+ assert r.status_code == 200
10
+ assert r.json() == {"Hello": "World"}