(self)
| 44 | self.assertFalse(os.path.exists(self.MO_FILE)) |
| 45 | |
| 46 | def test_no_write_access(self): |
| 47 | mo_file_en = Path(self.MO_FILE_EN) |
| 48 | err_buffer = StringIO() |
| 49 | # Put parent directory in read-only mode. |
| 50 | old_mode = mo_file_en.parent.stat().st_mode |
| 51 | mo_file_en.parent.chmod(stat.S_IRUSR | stat.S_IXUSR) |
| 52 | # Ensure .po file is more recent than .mo file. |
| 53 | mo_file_en.with_suffix(".po").touch() |
| 54 | try: |
| 55 | with self.assertRaisesMessage( |
| 56 | CommandError, "compilemessages generated one or more errors." |
| 57 | ): |
| 58 | call_command( |
| 59 | "compilemessages", locale=["en"], stderr=err_buffer, verbosity=0 |
| 60 | ) |
| 61 | self.assertIn("not writable location", err_buffer.getvalue()) |
| 62 | finally: |
| 63 | mo_file_en.parent.chmod(old_mode) |
| 64 | |
| 65 | def test_no_compile_when_unneeded(self): |
| 66 | mo_file_en = Path(self.MO_FILE_EN) |
nothing calls this directly
no test coverage detected