diff options
| author | Claude Paroz <claude@2xlibre.net> | 2020-06-19 10:25:42 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-06-22 08:33:00 +0200 |
| commit | ed0a040773f5bad187170ab4e3b094fe3108d702 (patch) | |
| tree | 2f69adfff55b69dc5ea1196222223515148dc691 /tests | |
| parent | f386454d1302b66d0eb331ed0ae9e4811e2f3a15 (diff) | |
Refs #31692 -- Updated compilemessages and tests to use pathlib.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/test_compilation.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/i18n/test_compilation.py b/tests/i18n/test_compilation.py index 04958bcbb4..fbacaee221 100644 --- a/tests/i18n/test_compilation.py +++ b/tests/i18n/test_compilation.py @@ -34,6 +34,7 @@ class PoFileTests(MessageCompilationTests): LOCALE = 'es_AR' MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE + MO_FILE_EN = 'locale/en/LC_MESSAGES/django.mo' def test_bom_rejection(self): stderr = StringIO() @@ -43,17 +44,17 @@ class PoFileTests(MessageCompilationTests): self.assertFalse(os.path.exists(self.MO_FILE)) def test_no_write_access(self): - mo_file_en = 'locale/en/LC_MESSAGES/django.mo' + mo_file_en = Path(self.MO_FILE_EN) err_buffer = StringIO() - # put file in read-only mode - old_mode = os.stat(mo_file_en).st_mode - os.chmod(mo_file_en, stat.S_IREAD) + # Put file in read-only mode. + old_mode = mo_file_en.stat().st_mode + mo_file_en.chmod(stat.S_IREAD) try: with self.assertRaisesMessage(CommandError, 'compilemessages generated one or more errors.'): call_command('compilemessages', locale=['en'], stderr=err_buffer, verbosity=0) self.assertIn('not writable location', err_buffer.getvalue()) finally: - os.chmod(mo_file_en, old_mode) + mo_file_en.chmod(old_mode) class PoFileContentsTests(MessageCompilationTests): |
