gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03499
[Merge] lp:~huxuan/gtg/fix-test-script into lp:gtg
Xuan Hu has proposed merging lp:~huxuan/gtg/fix-test-script into lp:gtg.
Requested reviews:
Gtg developers (gtg)
For more details, see:
https://code.launchpad.net/~huxuan/gtg/fix-test-script/+merge/104071
This branch try to solve bugs related to tests.
It's still in progress.
This propose is intended to get view of diff
--
https://code.launchpad.net/~huxuan/gtg/fix-test-script/+merge/104071
Your team Gtg developers is requested to review the proposed merge of lp:~huxuan/gtg/fix-test-script into lp:gtg.
=== modified file 'GTG/core/tag.py'
--- GTG/core/tag.py 2012-04-22 11:56:25 +0000
+++ GTG/core/tag.py 2012-04-30 08:39:19 +0000
@@ -82,7 +82,7 @@
string.
"""
if att_name == "name":
- raise Exception("The name of tag cannot be set manually")
+ raise Set_Name_Attribute_Error("The name of tag cannot be set manually")
elif att_name == "parent":
self.add_parent(att_value)
else:
@@ -184,3 +184,8 @@
def __str__(self):
return "Tag: %s" % self.get_name()
+
+class Set_Name_Attribute_Error(Exception):
+ """Exception raised when try to set attribute to name"""
+ def __init__(self, *args, **kwargs):
+ super(Set_Name_Attribute_Error, self).__init__(*args, **kwargs)
=== modified file 'GTG/tests/test_datastore.py'
--- GTG/tests/test_datastore.py 2012-03-05 15:23:05 +0000
+++ GTG/tests/test_datastore.py 2012-04-30 08:39:19 +0000
@@ -31,6 +31,7 @@
from GTG.core.datastore import DataStore
from GTG.backends.genericbackend import GenericBackend
from GTG.core import CoreConfig
+from liblarch import Tree
def sleep_within_loop(duration):
main_loop = gobject.MainLoop()
@@ -114,7 +115,7 @@
Tests the get_tasks_tree function
'''
tasks_tree = self.datastore.get_tasks_tree()
- self.assertTrue(isinstance(tasks_tree, GTG.tools.liblarch.Tree))
+ self.assertTrue(isinstance(tasks_tree, Tree))
def test_push_task(self):
'''
@@ -306,7 +307,8 @@
self.enabled = True
def queue_set_task(self, task):
- self.tasks_ids.append(task.get_id())
+ if task.get_id() not in self.tasks_ids:
+ self.tasks_ids.append(task.get_id())
def has_task(self, task_id):
return task_id in self.tasks_ids
=== modified file 'GTG/tests/test_tag.py'
--- GTG/tests/test_tag.py 2012-04-03 05:57:24 +0000
+++ GTG/tests/test_tag.py 2012-04-30 08:39:19 +0000
@@ -21,7 +21,7 @@
import unittest
-from GTG.core.tag import Tag
+from GTG.core.tag import Tag, Set_Name_Attribute_Error
from GTG.core.datastore import DataStore
from GTG.tests.signals_testing import GobjectSignalsManager
@@ -109,7 +109,10 @@
# The 'name' attribute is set by the constructor. After it is set, it
# cannot be changed with further calls to set_attribute.
tag = Tag('old', self.req)
- tag.set_attribute('name', 'new')
+ try:
+ tag.set_attribute('name', 'new')
+ except Set_Name_Attribute_Error:
+ pass
self.assertEqual('old', tag.get_name())
self.assertEqual('old', tag.get_attribute('name'))
@@ -126,7 +129,10 @@
# Setting the name attribute doesn't call save.
save_calls = []
tag = Tag('old', self.req)
- tag.set_attribute('name', 'new')
+ try:
+ tag.set_attribute('name', 'new')
+ except Set_Name_Attribute_Error:
+ pass
self.assertEqual(0, len(save_calls))
def test_intask_counting_after_rename(self):
=== modified file 'Makefile'
--- Makefile 2012-04-23 17:51:43 +0000
+++ Makefile 2012-04-30 08:39:19 +0000
@@ -6,6 +6,7 @@
# Get rid of stale files or files made during testing.
clean:
rm -rf doc/api
+ rm -rf GTG/test_build_api-*
find . -name '*.pyc' -print0 | xargs -0 rm -f
find . -name '*~' -print0 | xargs -0 rm -f
find . -name '.*.swp' -print0 | xargs -0 rm -f
Follow ups