Ticket #17008: 47b4795-tests-patch.diff

File 47b4795-tests-patch.diff, 1.4 KB (added by airstrike, 4 years ago)
  • tests/regressiontests/i18n/commands/extraction.py

    diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py
    index 4f47634..e380bfc 100755
    a b class NoWrapExtractorTests(ExtractorTests): 
    183183        self.assertTrue(os.path.exists(self.PO_FILE))
    184184        po_contents = open(self.PO_FILE, 'r').read()
    185185        self.assertMsgId('""\n"This literal should also be included wrapped or not wrapped depending on the "\n"use of the --no-wrap option."', po_contents, use_quotes=False)
     186
     187class KeepPotFileExtractorTests(ExtractorTests):
     188
     189    def tearDown(self):
     190        POT_FILE = self.PO_FILE + 't'
     191        super(KeepPotFileExtractorTests, self).tearDown()
     192        os.chdir(self.test_dir)
     193        try:
     194            os.unlink(POT_FILE)
     195        except OSError:
     196            pass
     197        os.chdir(self._cwd)
     198
     199    def test_keep_pot_disabled_by_default(self):
     200        POT_FILE = self.PO_FILE + 't'
     201        os.chdir(self.test_dir)
     202        management.call_command('makemessages', locale=LOCALE, verbosity=0)
     203        self.assertFalse(os.path.exists(POT_FILE))
     204
     205    def test_keep_pot_enabled(self):
     206        POT_FILE = self.PO_FILE + 't'
     207        os.chdir(self.test_dir)
     208        management.call_command('makemessages', locale=LOCALE, verbosity=0, keep_pot=True)
     209        self.assertTrue(os.path.exists(POT_FILE))
     210
Back to Top