Aymeric Augustin
unread,Feb 21, 2015, 6:08:38 AM2/21/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-d...@googlegroups.com
Hello,
Would it be a good property of the test suite to pass on a read-only checkout?
Here’s one way to try it without messing up your git checkout (guess why I’m
mentioning this):
% find django tests -type f -print0 | xargs -0 chmod u-w
% find django tests -type d -print0 | xargs -0 chmod u-w
% cd tests
% ./runtests.py
With the current master branch this results in:
FAILED (failures=7, errors=155, skipped=534, expected failures=6)
Specifically I would like to require all tests that touch the filesystem to
write exclusively in TEMP_DIR = os.environ['DJANGO_TEST_TEMP_DIR']. This has
several advantages:
- Since TEMP_DIR is shutil.rmtree'd during teardown, it guarantees that no
files will be leaked.
- It alleviates the need to serialize tests that write in the same filesystem
location when running tests in parallel, provided each runner uses its own
subdirectory inside TEMP_DIR.
- Writing files in the Django checkout during tests is gross: if a test fails,
sometimes these files show up in git status and must be manually removed.
- It may allow for faster tests by pointing TEMP_DIR to a RAM disk. On my test
parallelization branch, I/O appears to be the bottleneck even with a SSD and
an in-memory SQLite database. When CPU usage drops, iosnoop reports lots of
writes that clearly come from `collectstatic` or `makemessages`.
I foresee two difficulties:
- How do we enforce this in the long run? Can we run the CI server with a very
unprivileged user that isn’t allowed to write anywhere other than /tmp?
- makemessages isn’t flexible at all It’s going to be hard to convince it to write
its output outside of the directory it’s processing.
What do you think?
--
Aymeric.