def make_release_tree(self, base_dir, files): # Run the parent command first sdist.make_release_tree(self, base_dir, files) # Run translation-canary in release mode to remove any bad translations sys.path.append('translation-canary') from translation_canary.translated import testSourceTree # pylint: disable=import-error testSourceTree(base_dir, releaseMode=True)
def test_release_mode_failure_with_lingua(self): open(os.path.join(self.tmpdir, "aa.po"), "w").close() open(os.path.join(self.tmpdir, "pa.po"), "w").close() with open(os.path.join(self.tmpdir, "LINGUAS"), "w") as l: l.write("aa pa\n") self.assertTrue(testSourceTree(self.tmpdir, releaseMode=True)) self.assertTrue(os.path.exists(os.path.join(self.tmpdir, "aa.po"))) self.assertFalse(os.path.exists(os.path.join(self.tmpdir, "pa.po"))) with open(os.path.join(self.tmpdir, "LINGUAS")) as l: self.assertEqual(l.read().strip(), "aa")
def test_release_mode_failure(self): open(os.path.join(self.tmpdir, "aa.po"), "w").close() open(os.path.join(self.tmpdir, "pa.po"), "w").close() self.assertTrue(testSourceTree(self.tmpdir, releaseMode=True)) self.assertTrue(os.path.exists(os.path.join(self.tmpdir, "aa.po"))) self.assertFalse(os.path.exists(os.path.join(self.tmpdir, "pa.po")))
def test_release_mode_success(self): open(os.path.join(self.tmpdir, "aa.po"), "w").close() open(os.path.join(self.tmpdir, "ab.po"), "w").close() self.assertTrue(testSourceTree(self.tmpdir, releaseMode=True))
def test_all_failure(self): open(os.path.join(self.tmpdir, "pa.po"), "w").close() open(os.path.join(self.tmpdir, "pb.po"), "w").close() self.assertFalse(testSourceTree(self.tmpdir))
def test_success(self): open(os.path.join(self.tmpdir, "aa.po"), "w").close() open(os.path.join(self.tmpdir, "ab.po"), "w").close() self.assertTrue(testSourceTree(self.tmpdir))