Skip to content

Commit

Permalink
fix: skip test if user is not root
Browse files Browse the repository at this point in the history
  • Loading branch information
elkaboussi committed Mar 3, 2024
1 parent 8dec872 commit acca236
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM python:3.9-slim-bookworm
FROM python:3.12-slim-bookworm

ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# ENV VIRTUAL_ENV=/opt/venv
# ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY requirements.txt /tmp/requirements.txt

WORKDIR /app

RUN set -ex &&\
python3 -m venv $VIRTUAL_ENV &&\
pip install --upgrade pip &&\
pip install --no-cache -r /tmp/requirements.txt &&\
rm -rf /var/lib/apt/lists/*
Expand Down
5 changes: 4 additions & 1 deletion tests/test_directory_traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ def test_walk_through_dir_with_permission_error(
fs.create_file(bad_permission_file, st_mode=0o222)
fs.chmod(dir_with_bad_permission, 0o000) # Set permission to None
list(walk_through_dir(dir_with_bad_permission))
assert "Permission error accessing directory" in capsys.readouterr().err
# Skip the test if the user is not root
# Root user doesn't have permission issues
if os.getuid() != 0:
assert "Permission error accessing directory" in capsys.readouterr().err

0 comments on commit acca236

Please sign in to comment.