Code

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

File 47b4795-tests-patch.diff, 1.4 KB (added by airstrike, 3 years ago)
Line 
1diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py
2index 4f47634..e380bfc 100755
3--- a/tests/regressiontests/i18n/commands/extraction.py
4+++ b/tests/regressiontests/i18n/commands/extraction.py
5@@ -183,3 +183,28 @@ class NoWrapExtractorTests(ExtractorTests):
6         self.assertTrue(os.path.exists(self.PO_FILE))
7         po_contents = open(self.PO_FILE, 'r').read()
8         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)
9+
10+class KeepPotFileExtractorTests(ExtractorTests):
11+
12+    def tearDown(self):
13+        POT_FILE = self.PO_FILE + 't'
14+        super(KeepPotFileExtractorTests, self).tearDown()
15+        os.chdir(self.test_dir)
16+        try:
17+            os.unlink(POT_FILE)
18+        except OSError:
19+            pass
20+        os.chdir(self._cwd)
21+
22+    def test_keep_pot_disabled_by_default(self):
23+        POT_FILE = self.PO_FILE + 't'
24+        os.chdir(self.test_dir)
25+        management.call_command('makemessages', locale=LOCALE, verbosity=0)
26+        self.assertFalse(os.path.exists(POT_FILE))
27+
28+    def test_keep_pot_enabled(self):
29+        POT_FILE = self.PO_FILE + 't'
30+        os.chdir(self.test_dir)
31+        management.call_command('makemessages', locale=LOCALE, verbosity=0, keep_pot=True)
32+        self.assertTrue(os.path.exists(POT_FILE))
33+