Skip to content

Commit

Permalink
Add new "python-no-pyc" test
Browse files Browse the repository at this point in the history
This test validates that the Python images do not contain any pre-compiled `.pyc` or `.pyo` files in `/usr/local` (or `/opt`, for good measure).

Ideally this would also include all of `/usr` (not just `/usr/local`) but then it would also have to filter out results that are from Debian packages (`python`'s default variants are `FROM buildpack-deps` which includes a fair amount of Python packages).
  • Loading branch information
tianon committed Feb 19, 2022
1 parent bd0d9ff commit fa13be6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ imageTests+=(
[python]='
python-hy
python-imports
python-no-pyc
python-pip-requests-ssl
python-sqlite3
python-stack-size
Expand Down
1 change: 1 addition & 0 deletions test/tests/python-no-pyc/container.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rem N/A: Windows-based Python images may or may not contain ".pyc" and/or ".pyo" files because they are not a significant contributor to the overall image size
4 changes: 4 additions & 0 deletions test/tests/python-no-pyc/container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -eu

find /usr/local /opt '(' -name '*.pyc' -o -name '*.pyo' ')' -print -exec false '{}' +
1 change: 1 addition & 0 deletions test/tests/python-no-pyc/run.sh

0 comments on commit fa13be6

Please sign in to comment.