Skip to content

Commit 42622e4

Browse files
committed
HW 07: renaming
1 parent 7527e9d commit 42622e4

File tree

6 files changed

+218
-8
lines changed

6 files changed

+218
-8
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ repos:
3636
rev: v1.10.0
3737
hooks:
3838
- id: mypy
39+
exclude: 'tests'
3940

4041
# run local pylint in venv
4142
- repo: local
@@ -50,7 +51,7 @@ repos:
5051
- --max-line-length=120
5152
- --ignore-imports=yes
5253
- -d duplicate-code
53-
- -d C0111,W0621,R0913,R1705, W0201
54+
- -d C0111,W0621,R0913,R1705,W0201,W0613
5455

5556

5657
- repo: https://github.com/asottile/pyupgrade

homework_07/poetry.lock

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

homework_07/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ readme = "README.md"
88

99
[tool.poetry.dependencies]
1010
python = "^3.12"
11+
requests = "^2.32.3"
12+
types-requests = "^2.32.0.20250328"
1113

1214

1315
[build-system]

homework_07/tests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# flake8: noqa
2+
import web_server

homework_07/tests/test_server.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import threading
2+
import time
3+
4+
import pytest
5+
import requests
6+
from web_server import HOST, PORT, start_server
7+
8+
9+
@pytest.fixture(scope="module")
10+
def server():
11+
server_thread = threading.Thread(target=start_server)
12+
server_thread.start()
13+
time.sleep(1) # start delay
14+
yield
15+
16+
17+
def test_index_page(server):
18+
response = requests.get(f"http://{HOST}:{PORT}/", timeout=1)
19+
assert response.status_code == 200
20+
assert "index.html" in response.text
21+
22+
23+
def test_not_found_page(server):
24+
response = requests.get(f"http://{HOST}:{PORT}/noexist_page.html", timeout=1)
25+
assert response.status_code == 404
26+
assert "File Not Found" in response.text

0 commit comments

Comments
 (0)