[damned-lies] Reenable tests with file modifications
- From: Claude Paroz <claudep src gnome org>
- To: svn-commits-list gnome org
- Subject: [damned-lies] Reenable tests with file modifications
- Date: Sat, 18 Apr 2009 08:43:30 -0400 (EDT)
commit 08db8f48181f6b3fafba5894352c99de2ceca0c3
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Apr 18 14:37:33 2009 +0200
Reenable tests with file modifications
With the checkout argument of update_stats, tests can now update
branch statistics without resetting the checkout to origin.
---
stats/models.py | 5 +++--
stats/tests/__init__.py | 17 ++++++++---------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/stats/models.py b/stats/models.py
index 7aed70f..9309a86 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -277,9 +277,10 @@ class Branch(models.Model):
self._ui_stats = self.get_stats('ui', mandatory_langs)
return self._ui_stats
- def update_stats(self, force):
+ def update_stats(self, force, checkout=True):
""" Update statistics for all po files from the branch """
- self.checkout()
+ if checkout:
+ self.checkout()
domains = Domain.objects.filter(module=self.module).all()
string_frozen = self.has_string_frozen()
for dom in domains:
diff --git a/stats/tests/__init__.py b/stats/tests/__init__.py
index b91c6e3..064755a 100644
--- a/stats/tests/__init__.py
+++ b/stats/tests/__init__.py
@@ -87,9 +87,9 @@ class ModuleTestCase(unittest.TestCase):
# FIXME: deleting a git branch doesn't delete the repo
#self.assertFalse(os.access(checkout_path, os.F_OK))
- # FIXME: Desactivated, because git checkout reset the tree (and POTFILES.in...)
- def tstStringFrozenMail(self):
-
+ def testStringFrozenMail(self):
+ """ String change for a module of a string_frozen release should generate a message """
+ mail.outbox = []
self.rel.string_frozen = True
self.rel.save()
@@ -104,21 +104,20 @@ class ModuleTestCase(unittest.TestCase):
f.write("dummy_file.py\n")
f.close()
# Regenerate stats (mail should be sent)
- self.b.update_stats(force=False)
+ self.b.update_stats(force=False, checkout=False)
# Assertions
self.assertEquals(len(mail.outbox), 1);
- self.assertEquals(mail.outbox[0].subject, "String additions to 'gnome-hello.HEAD'")
+ self.assertEquals(mail.outbox[0].subject, "String additions to 'gnome-hello.master'")
self.assertTrue(mail.outbox[0].message().as_string().find(new_string)>-1)
- # FIXME: Desactivated, because git checkout reset the tree (and fr/figures/gnome-hello.png...)
- def tstIdenticalFigureWarning(self):
+ def testIdenticalFigureWarning(self):
""" Detect warning if translated figure is identical to original figure """
self.b.checkout()
orig_figure = os.path.join(self.b.co_path(), "help", "C", "figures", "gnome-hello.png")
shutil.copy(orig_figure, os.path.join(self.b.co_path(), "help", "fr", "figures", "gnome-hello.png"))
- self.b.update_stats(force=True)
+ self.b.update_stats(force=True, checkout=False)
doc_stat = Statistics.objects.get(branch=self.b, domain__name='help', language__locale='fr')
- warn_infos = Information.objects.filter(statistics=doc_stat, type='warn')
+ warn_infos = Information.objects.filter(statistics=doc_stat, type='warn-ext')
self.assertEquals(len(warn_infos), 1);
ui_stat = Statistics.objects.get(branch=self.b, domain__name='po', language__locale='fr')
self.assertEquals(ui_stat.po_url(), u"/POT/gnome-hello.master/gnome-hello.master.fr.po");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]