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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/A2673A7A-53CB-412F-ABDA-BAA6CB9774AC%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to