Merge lp:~nataliabidart/ubuntuone-client/remove-asserts into lp:ubuntuone-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~nataliabidart/ubuntuone-client/remove-asserts
Merge into: lp:ubuntuone-client
Prerequisite: lp:~nataliabidart/ubuntuone-client/unsubscribe-udf-if-broken-path
Diff against target: 197 lines (+42/-86)
2 files modified
tests/syncdaemon/test_eq_inotify.py (+20/-19)
tests/syncdaemon/test_localrescan.py (+22/-67)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-client/remove-asserts
Reviewer Review Type Date Requested Status
Facundo Batista (community) Approve
dobey (community) Approve
Review via email: mp+17840@code.launchpad.net

Commit message

Fixed test asserts so twisted fails because of the assertion failed and not because timeout.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Fixed test asserts so twisted fails because of the assertion failed and not because timeout.

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Facundo Batista (facundo) wrote :

Like it!

review: Approve
Revision history for this message
Facundo Batista (facundo) wrote :
Download full text (11.8 KiB)

===============================================================================
[ERROR]: tests.syncdaemon.test_eq_inotify.AncestorsUDFTestCase.test_file_events_are_ignored_on_udf_ancestor

Traceback (most recent call last):
Failure: twisted.python.failure.DefaultException:
===============================================================================
[ERROR]: tests.syncdaemon.test_eq_inotify.AncestorsUDFTestCase.test_file_events_are_ignored_on_udf_ancestor

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 757, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/tests/syncdaemon/test_eq_inotify.py", line 1166, in check
    self.assertEquals([], self.listener.events)
  File "/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/tests/syncdaemon/test_eq_inotify.py", line 1140, in failUnlessEqual
    raise exception
twisted.trial.unittest.FailTest: not equal:
a = []
b = [('VM_UDF_CREATED', (<ubuntuone.syncdaemon.volume_manager.UDF object at 0xa1f8f6c>,), {})]

===============================================================================
[ERROR]: tests.syncdaemon.test_eq_inotify.AncestorsUDFTestCase.test_file_events_are_not_ignored_on_common_prefix_name

Traceback (most recent call last):
Failure: twisted.python.failure.DefaultException:
===============================================================================
[ERROR]: tests.syncdaemon.test_eq_inotify.AncestorsUDFTestCase.test_file_events_are_not_ignored_on_common_prefix_name

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 757, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/tests/syncdaemon/test_eq_inotify.py", line 1245, in check
    self.assertEquals(expected, self.listener.events)
  File "/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/tests/syncdaemon/test_eq_inotify.py", line 1140, in failUnlessEqual
    raise exception
twisted.trial.unittest.FailTest: not equal:
a = [('FS_FILE_CREATE', ('/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/_trial_temp/tmp/tests.syncdaemon.test_eq_inotify/AncestorsUDFTestCase/test_file_events_are_not_ignored/tmpdir/ubuntuonehacker/Documents/Reading/Book/testit',), {}), ('FS_FILE_OPEN', ('/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/_trial_temp/tmp/tests.syncdaemon.test_eq_inotify/AncestorsUDFTestCase/test_file_events_are_not_ignored/tmpdir/ubuntuonehacker/Documents/Reading/Book/testit',), {}), ('FS_FILE_CLOSE_WRITE', ('/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/_trial_temp/tmp/tests.syncdaemon.test_eq_inotify/AncestorsUDFTestCase/test_file_events_are_not_ignored/tmpdir/ubuntuonehacker/Documents/Reading/Book/testit',), {}), ('FS_FILE_OPEN', ('/home/facundo/canonical/u1-client/review_remove-watches-even-on-rename/_trial_temp/tmp/tests.syncdaemon.test_eq_inotify/AncestorsUDFTestCase/test_file_events_are_not_ignored/tmpdir/ubuntuonehacker/Documents/Reading/...

review: Needs Fixing
Revision history for this message
Facundo Batista (facundo) wrote :

> Ran 47 tests in 8.038s
>
> FAILED (errors=8, successes=43)

Ignore this, I'm too stupid to change tabs, :|

Revision history for this message
Facundo Batista (facundo) :
review: Approve
Revision history for this message
Elliot Murphy (statik) wrote :
Download full text (11.5 KiB)

The attempt to merge lp:~nataliabidart/ubuntuone-client/remove-asserts into lp:ubuntuone-client failed.Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
(B testing autoconf2.50... not found.
  testing autoconf... found 2.65
checking for automake >= 1.10...
(B testing automake-1.11... found 1.11
checking for libtool >= 1.5...
(B testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
(B testing intltoolize... found 0.41.0
checking for pkg-config >= 0.14.0...
(B testing pkg-config... found 0.22
Checking for required M4 macros...
(BChecking for forbidden M4 macros...
(BProcessing ./configure.ac
(BRunning libtoolize...
(Blibtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
(BRunning aclocal-1.11...
(BRunning autoconf...
(BRunning autoheader...
(BRunning automake-1.11...
(BRunning ./configure --prefix=/usr ...
(Bchecking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... ...

Revision history for this message
dobey (dobey) wrote :

Attempt to merge lp:~nataliabidart/ubuntuone-client/remove-asserts into lp:ubuntuone-client failed due to merge conflicts:

text conflict in tests/syncdaemon/test_localrescan.py

330. By Natalia Bidart

Merged trunk in and resolved conflicts.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

> Attempt to merge lp:~nataliabidart/ubuntuone-client/remove-asserts into lp
> :ubuntuone-client failed due to merge conflicts:
>
> text conflict in tests/syncdaemon/test_localrescan.py

Conflicts resolved! Thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_eq_inotify.py'
2--- tests/syncdaemon/test_eq_inotify.py 2010-01-25 20:43:33 +0000
3+++ tests/syncdaemon/test_eq_inotify.py 2010-01-26 12:20:28 +0000
4@@ -126,6 +126,26 @@
5 """Called to indicate that the tests finished badly."""
6 self._deferred.errback(Exception(msg))
7
8+ def failUnlessEqual(self, first, second, msg=''):
9+ """Fail the test if C{first} and C{second} are not equal.
10+
11+ @param msg: A string describing the failure that's included in the
12+ exception.
13+
14+ """
15+ if not first == second:
16+ if msg is None:
17+ msg = ''
18+ if len(msg) > 0:
19+ msg += '\n'
20+ exception = self.failureException(
21+ '%snot equal:\na = %s\nb = %s\n'
22+ % (msg, repr(first), repr(second)))
23+ self.finished_error(exception)
24+ raise exception
25+ return first
26+ assertEqual = assertEquals = failUnlessEquals = failUnlessEqual
27+
28
29 class SignalingTests(BaseTwisted):
30 """Test the whole stuff to receive signals."""
31@@ -1132,25 +1152,6 @@
32
33 BaseTwisted.tearDown(self)
34
35- def failUnlessEqual(self, first, second, msg=''):
36- """
37- Fail the test if C{first} and C{second} are not equal.
38-
39- @param msg: A string describing the failure that's included in the
40- exception.
41- """
42- if not first == second:
43- if msg is None:
44- msg = ''
45- if len(msg) > 0:
46- msg += '\n'
47- exception = self.failureException(
48- '%snot equal:\na = %s\nb = %s\n'
49- % (msg, repr(first), repr(second)))
50- self.finished_error(exception)
51- return first
52- assertEqual = assertEquals = failUnlessEquals = failUnlessEqual
53-
54 def test_file_events_are_ignored_on_udf_ancestor(self):
55 """Events on UDF ancestors are ignored."""
56 for path in self.ancestors:
57
58=== modified file 'tests/syncdaemon/test_localrescan.py'
59--- tests/syncdaemon/test_localrescan.py 2010-01-25 20:43:33 +0000
60+++ tests/syncdaemon/test_localrescan.py 2010-01-26 12:20:28 +0000
61@@ -1633,8 +1633,14 @@
62 def setUp(self):
63 """Init."""
64 BaseTestCase.setUp(self)
65- self.deferred = defer.Deferred()
66+ self._deferred = defer.Deferred()
67 self.eq = event_queue.EventQueue(self.fsm)
68+ self.original_add = self.eq.inotify_add_watch
69+ self.original_has = self.eq.inotify_has_watch
70+ self.watches = []
71+ self.eq.inotify_add_watch = lambda path: self.watches.append(path)
72+ self.eq.inotify_has_watch = lambda path: path in self.watches
73+
74 self.lr = LocalRescan(self.vm, self.fsm, self.eq, self.aq)
75
76 self.env_var = 'HOME'
77@@ -1655,6 +1661,9 @@
78
79 def tearDown(self):
80 """Cleanup."""
81+ self.eq.inotify_add_watch = self.original_add
82+ self.eq.inotify_has_watch = self.original_has
83+
84 self.eq.shutdown()
85 self.eq = None
86
87@@ -1665,98 +1674,44 @@
88
89 BaseTestCase.tearDown(self)
90
91- def SKIP_test_parent_has_watch(self):
92- """UDF's parent has a watch."""
93-
94- l = testcase.Listener()
95- self.eq.subscribe(l)
96-
97- parent = os.path.dirname(self.udf.path)
98-
99- dummy = os.path.join(parent, 'testit')
100- expected = [('FS_FILE_CREATE', (dummy,), {}),
101- ('FS_FILE_OPEN', (dummy,), {}),
102- ('FS_FILE_CLOSE_WRITE', (dummy,), {})]
103-
104- def parent_has_watch():
105- """Check."""
106- self.assertEquals(expected, l.events)
107- # make the test finish
108- self.deferred.callback(None)
109-
110- def modify_parent(_):
111- """Touch a file within UDF's parent."""
112- open(dummy, 'w').close() # touch a dummy file
113-
114- reactor.callLater(.1, parent_has_watch)
115-
116- d = defer.Deferred()
117- d.addCallback(lambda x: self.lr.start())
118- d.addCallback(modify_parent)
119- d.callback(None)
120-
121- self.addCleanup(lambda: self.eq.unsubscribe(l))
122-
123- return self.deferred
124-
125 def test_ancestors_have_watch(self):
126 """UDF's ancestors have a watch."""
127
128- original = self.eq.inotify_add_watch
129- watches = []
130- self.eq.inotify_add_watch = lambda path: watches.append(path)
131-
132 def ancestors_have_watch(_):
133 """Check."""
134 expected = set(self.ancestors)
135- actual = set(watches)
136+ actual = set(self.watches)
137 if expected.issubset(actual):
138 # make the test finish ok
139- self.deferred.callback(True)
140+ self._deferred.callback(True)
141 else:
142 difference = expected.symmetric_difference(actual)
143 msg = 'Expected (%s)\n\n' \
144 'Is not subset of real watches (%s).\n\n' \
145- 'Set difference is: %s.' % (expected, watches, difference)
146- self.deferred.errback(msg)
147+ 'Set symmetric difference is: %s.' % \
148+ (expected, actual, difference)
149+ self._deferred.errback(msg)
150
151- d = defer.Deferred()
152- d.addCallback(lambda x: self.lr.start())
153+ d = self.lr.start()
154 d.addCallback(ancestors_have_watch)
155- d.callback(None)
156-
157- self.addCleanup(lambda: setattr(self.eq, 'inotify_add_watch', original))
158-
159- return self.deferred
160+ return self._deferred
161
162 def test_watch_is_not_added_if_present(self):
163 """Watches are not added if present."""
164- original_add = self.eq.inotify_add_watch
165- original_has = self.eq.inotify_has_watch
166- watches = []
167- self.eq.inotify_add_watch = lambda path: watches.append(path)
168- self.eq.inotify_has_watch = lambda path: path in watches
169
170 for path in self.ancestors:
171 self.eq.inotify_add_watch(path)
172
173 def no_watch_added(_):
174 """Check."""
175- for path in self.ancestors:
176- self.assertEquals(1, watches.count(path))
177- self.deferred.callback(None)
178+ for path in self.udf.ancestors:
179+ self.assertEquals(1, self.watches.count(path))
180
181 d = self.lr.start()
182 d.addCallback(no_watch_added)
183-
184- def restore():
185- """Restore overriden methods."""
186- self.eq.inotify_add_watch = original_add
187- self.eq.inotify_has_watch = original_has
188-
189- self.addCleanup(restore)
190-
191- return self.deferred
192+ d.addCallback(lambda _:
193+ self._deferred.callback(None))
194+ return self._deferred
195
196
197 def test_suite():

Subscribers

People subscribed via source and target branches