Complete the code to run pytest inside a Docker container using the correct command.
docker run --rm -v $(pwd):/app -w /app python:3.12 [1]
The pytest command runs the tests inside the Docker container. Using python or bash won't run tests directly, and pip install pytest is for installing, not running tests.
Complete the code to mount the current directory into the Docker container for test access.
docker run --rm -v [1]:/app -w /app python:3.12 pytest
Using $(pwd) mounts the current directory from the host into the container, allowing tests to access the code.
Fix the error in the Docker command to ensure the working directory is set correctly for pytest.
docker run --rm -v $(pwd):/app -w [1] python:3.12 pytest
The working directory inside the container must match the mount point /app so pytest finds the tests.
Fill both blanks to create a Docker command that installs pytest and runs tests inside the container.
docker run --rm -v $(pwd):/app -w /app python:3.12 bash -c "[1] && [2]"
First, pip install pytest installs pytest, then pytest runs the tests.
Fill all three blanks to define a Docker Compose service that runs pytest with mounted volume and working directory.
services:
test:
image: python:3.12
volumes:
- [1]:/app
working_dir: [2]
command: [3]The volume mounts the current directory . to /app. The working directory is set to /app, and the command runs pytest.