Skip to content

Commit 4439000

Browse files
authored
Merge pull request #361 from hexlet-basics/update-tests
Update tests
2 parents 2722825 + 0e1c6dd commit 4439000

203 files changed

Lines changed: 522 additions & 471 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
FROM hexletbasics/base-image
22

3-
# Configure versions and paths up front for better caching
43
ARG PYTHON_VERSION=3.14
54

6-
# Keep project bin in PATH (existing convention)
7-
ENV PATH="/exercises-python/bin:${PATH}"
8-
9-
# Install curl and CA certs (minimal), then install uv via official script
105
ENV UV_INSTALL_DIR=/opt/uv
116
ENV PATH="${UV_INSTALL_DIR}/bin:${PATH}"
127
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
@@ -15,18 +10,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certifi
1510
&& curl -fsSL https://astral.sh/uv/install.sh | sh \
1611
&& ln -s ${UV_INSTALL_DIR}/* /usr/local/bin/
1712

18-
# Create a dedicated virtualenv managed by uv with the requested Python
1913
ENV VIRTUAL_ENV=/opt/venv
20-
ENV UV_PYTHON_INSTALL_DIR=${VIRTUAL_ENV}
21-
RUN uv venv --allow-existing ${VIRTUAL_ENV} --python ${PYTHON_VERSION}
14+
RUN uv venv ${VIRTUAL_ENV} --python ${PYTHON_VERSION}
2215

23-
# Activate venv for subsequent steps and point uv to it for project deps
24-
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
16+
ENV PATH="${VIRTUAL_ENV}/bin:/exercises-python/bin:${PATH}"
2517
ENV UV_PROJECT_ENVIRONMENT=${VIRTUAL_ENV}
2618

2719
WORKDIR /exercises-python
2820

29-
# Cache dependencies: copy manifests first, sync, then copy the rest
3021
COPY pyproject.toml uv.lock ./
3122
RUN uv sync --locked
3223

File renamed without changes.

modules/10-basics/10-hello-world/test_code.py

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import runpy
2+
3+
4+
def test(capsys):
5+
expected = "Hello, World!"
6+
runpy.run_module('solution')
7+
out, _ = capsys.readouterr()
8+
assert out.strip() == expected
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
def test():
2-
with open("index.py") as file:
2+
with open("solution.py") as file:
33
comment = file.read().rstrip()
44
assert comment == "# TODO: добавить функцию приветствия"
55
print(comment)
File renamed without changes.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
from hexlet.test import expect_output
1+
import runpy
22

33

44
def test(capsys):
55
expected = "Заказ №1337\nСтатус: доставляется\nПримерный срок: 2 дня"
6-
expect_output(capsys, expected)
6+
runpy.run_module('solution')
7+
out, _ = capsys.readouterr()
8+
assert out.strip() == expected

modules/10-basics/40-testing/test_code.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)