Skip to content

Commit eac2245

Browse files
committed
test: chmod only container-owned files in coverage_command
1 parent 1f2c1ef commit eac2245

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

bin/lib/test/_shared.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
def coverage_command(extra_args):
77
"""Bash one-liner: run manage.py under coverage, write XML, print report, preserve test exit code."""
88
args_str = " ".join(shlex.quote(a) for a in extra_args)
9-
# chmod opens up the bind-mount output so the host (CI runner, dev user)
10-
# can read coverage.xml regardless of which UID the container runs as.
9+
# Open up the bind-mount output so the host (CI runner, dev user) can read
10+
# coverage.xml regardless of which UID the container runs as. Filter to
11+
# files owned by the current UID — pre-existing committed fixtures belong
12+
# to the host user and chmod requires ownership, not just write bits.
1113
return (
1214
f'coverage run --source="." manage.py test --settings=tests.settings --no-input {args_str}; '
1315
"exit_code=$?; "
1416
"coverage xml -o data_store/coverage.xml; "
15-
"chmod -R a+rw data_store; "
17+
'find data_store -user "$(id -u)" -exec chmod a+rw {} +; '
1618
"coverage report -m; "
1719
"exit $exit_code"
1820
)

0 commit comments

Comments
 (0)