Skip to content

Commit

Permalink
Update test setup of text_normalization component (#369)
Browse files Browse the repository at this point in the history
This PR aligns the test setup of the `text_normalization` component with
the one of the `download_images` component introduced in #354
  • Loading branch information
RobbeSneyders authored Aug 18, 2023
1 parent bd21e5a commit edadd15
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
27 changes: 15 additions & 12 deletions components/text_normalization/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
FROM --platform=linux/amd64 python:3.8-slim as base

## System dependencies
# System dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install git -y

RUN pip3 install fondant[aws,azure,gcp]@git+https://github.com/mrchtr/fondant

# install requirements
# Install requirements
COPY requirements.txt /
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy over src-files
# Install Fondant
# This is split from other requirements to leverage caching
ARG FONDANT_VERSION=main
RUN pip3 install fondant[aws,azure,gcp]@git+https://github.com/ml6team/fondant@${FONDANT_VERSION}

# Set the working directory to the component folder
WORKDIR /component
COPY src/ src/
ENV PYTHONPATH "${PYTHONPATH}:./src"

# Run component tests
FROM base as test
RUN pip3 install pytest # TODO add pytest to package setup
ENV PYTHONPATH "${PYTHONPATH}:./src"
COPY test_requirements.txt .
RUN pip3 install --no-cache-dir -r test_requirements.txt
COPY tests/ tests/
RUN ["python", "-m", "pytest", "tests/"]
RUN python -m pytest tests

FROM base
# Set the working directory to the component folder
WORKDIR /src
ENTRYPOINT ["python", "main.py"]
WORKDIR /component/src
ENTRYPOINT ["python", "main.py"]
1 change: 1 addition & 0 deletions components/text_normalization/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest==7.4.0

0 comments on commit edadd15

Please sign in to comment.