Opened 9 years ago
Last modified 8 years ago
#26677 closed Cleanup/optimization
Run i18n tests on disposablle FS tree instead of source code — at Initial Version
Reported by: | Ramiro Morales | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Normal | Keywords: | tests isolation i18n serializemixin unit unittest |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently, tests that exercise translatable literal extraction to .po
files by makemessages (located on test_extraction.py
) and test that exercise compilation of .po
files to .mo
files by compilemessages (test_compilation.py
) are run under the test/i18n
test source code tree creating subdirectories and files under the different work projects/applications loated there.
Proposal is to copy the relevant filesystem tree to a tempdir as provided by runtests.py
+ tempfile.mkdtemp()
as part of every test case setup.
This has the following advantages:
- Avoid weird bogus errors and failures caused by stray directories left by previous runs/debugging sessions.
- Allows us to solve the fact that currently tests on
test_compilation.py
aren't marked as needing seralized execution and are actually being run in parallel which causes a couple of consecutive runs if the i18n test on my Ubuntu 1.4.04 system to report misleading failures, most probably because of race conditions. - Ensure actual isolation among test cases
- Allow each of these test cases to be actually run in in parallel by our existing machinery. This allows us to be able to stop relying on
django.test.testcases.SerializeMixin
These changes possibly aren't visible on our CI infrastructure as every job there always use a clean tree but can be of help to those running the test suite and/or working on i18n tests.
Other tests (tests.py
, test_percents.py
) don't have write access to disk so they are unaffected.