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 18, 2022
1 parent bd0d9ff commit 4137198
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 TODO implement this check on Windows images too 🙈
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 4137198

Please sign in to comment.