Merge lp:~mbp/bzr/deprecation into lp:bzr
| Status: | Merged |
|---|---|
| Approved by: | Martin Pool on 2010-07-13 |
| Approved revision: | no longer in the revision history of the source branch. |
| Merged at revision: | 5343 |
| Proposed branch: | lp:~mbp/bzr/deprecation |
| Merge into: | lp:bzr |
| Diff against target: |
200 lines (+41/-72) 5 files modified
bzrlib/tests/blackbox/test_status.py (+2/-14) bzrlib/tests/test_http.py (+14/-51) bzrlib/tests/test_remote.py (+1/-4) bzrlib/tests/test_smart_request.py (+5/-3) doc/developers/testing.txt (+19/-0) |
| To merge this branch: | bzr merge lp:~mbp/bzr/deprecation |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| John A Meinel | 2010-06-24 | Needs Fixing on 2010-06-28 | |
| Vincent Ladeuil | 2010-06-15 | Approve on 2010-06-24 | |
| Robert Collins (community) | Needs Fixing on 2010-06-24 | ||
|
Review via email:
|
|||
Commit Message
change some test tearDowns to addCleanup or overrideAttr
Description of the Change
This deletes some tearDown methods from test cases and adds generally shorter calls to addCleanup, and a request people do this in future.
These cope better if some cleanups fail to run etc.
Now updated to use overrideAttr where appropriate, to suggest that in the docs, and to remove repetition from test_http.
| Martin Pool (mbp) wrote : | # |
sent to pqm by email
| Robert Collins (lifeless) wrote : | # |
This has conflicts as vincent warned about.
Whats up with this:
38 +<<<<<<< TREE
39 # Copyright (C) 2005-2010 Canonical Ltd
40 +=======
41 +# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
42 +>>>>>>> MERGE-SOURCE
43 #
The 2005-2010 form is a lot pithier; I don't recall a policy decision to avoid it?
Could you please comment on vincents notes about using overrideAttr too. Thanks.
| Martin Pool (mbp) wrote : | # |
On 21 June 2010 07:29, Robert Collins <email address hidden> wrote:
> Review: Needs Information
> This has conflicts as vincent warned about.
>
> Whats up with this:
>
> 38 +<<<<<<< TREE
> 39 # Copyright (C) 2005-2010 Canonical Ltd
> 40 +=======
> 41 +# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
> 42 +>>>>>>> MERGE-SOURCE
> 43 #
>
> The 2005-2010 form is a lot pithier; I don't recall a policy decision to avoid it?
I think John did a batch update to the first form and I arbitrarily
resolved the conflict to the first. The shorter form is fine with me.
> Could you please comment on vincents notes about using overrideAttr too. Thanks.
I didn't forget to use overrideAttr, I just wrote this before it was landed.
--
Martin
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> On 21 June 2010 07:29, Robert Collins <email address hidden> wrote:
>> Review: Needs Information
>> This has conflicts as vincent warned about.
>>
>> Whats up with this:
>>
>> 38 +<<<<<<< TREE
>> 39 # Copyright (C) 2005-2010 Canonical Ltd
>> 40 +=======
>> 41 +# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
>> 42 +>>>>>>> MERGE-SOURCE
>> 43 #
>>
>> The 2005-2010 form is a lot pithier; I don't recall a policy decision to avoid it?
>
> I think John did a batch update to the first form and I arbitrarily
> resolved the conflict to the first. The shorter form is fine with me.
>
>> Could you please comment on vincents notes about using overrideAttr too. Thanks.
>
> I didn't forget to use overrideAttr, I just wrote this before it was landed.
>
I have a pre-commit hook "update-copyright" plugin that checks the
history for the file and updates the copyright line to match.
In the past there was a discussion of whether the pithy form was
"legally ok" (long time ago). So I used the expanded form. Then I saw
Martin manually writing the pithy form, and I was happy to update the
plugin to use it. (I prefer it, as it seems does everyone but
potentially lawyers.)
Vincent and I are both using the plugin, so things will converge on that
form. (It only updates files that are already modified.)
The only other difference is that it actually does the exact years. So a
file that was modified in 2005, 2006, 2007, 2009, 2010, 2011, will get 2
ranges: 2005-2007, 2009-2011, whereas a human is probably likely to just
collapse that to 2005-2011.
I *certainly* am not a lawyer, or even have a great grasp of why each
file has a copyright line and why that line differs per file. (Why not
just have 1 2005-2010 copyright line at the top of every file...)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkw
hwEAn1nbcreJ8sk
=tpwn
-----END PGP SIGNATURE-----
| Robert Collins (lifeless) wrote : | # |
I need to look at TestActivityMixin - it looks, right now, like you end up not upcalling in setUp, and that should cause a failure in the test framework.
Other than that it looks pretty nice now. So 'tweak'.
| Vincent Ladeuil (vila) wrote : | # |
Nice cleanup, thanks.
131 + self._transport =_urllib.
missing space after the '=' sign (I know it wasn't there before either ;)
The distinction between TestActivity and TestNoReportAct
is unclear (says who ?) so I mentioned it in https:/
Thanks to your cleanup the flaw is more obvious now.
| Martin Pool (mbp) wrote : | # |
sent to pqm by email
| Martin Pool (mbp) wrote : | # |
> I need to look at TestActivityMixin - it looks, right now, like you end up not
> upcalling in setUp, and that should cause a failure in the test framework.
>
> Other than that it looks pretty nice now. So 'tweak'.
It is just a mixin, and the concrete test subclasses do upcall (I think.)
There is a thing here where if it was sufficiently clean to do official parameterization, people wouldn't generate such mixins. But I got rid of a bit of copy and paste, perhaps vila will do more later.
| Vincent Ladeuil (vila) wrote : | # |
> There is a thing here where if it was sufficiently clean to do official
> parameterization, people wouldn't generate such mixins. But I got rid of a
> bit of copy and paste, perhaps vila will do more later.
As part of bug #597791, yes.
| Robert Collins (lifeless) wrote : | # |
Ok, +1
| John A Meinel (jameinel) wrote : | # |
sent to pqm by email
| John A Meinel (jameinel) wrote : | # |
This is failing with:
=======
ERROR: bzrlib.
-------
_StringException: Text attachment: traceback
------------
Traceback (most recent call last):
File "/usr/lib/
return fn(*args)
File "/usr/lib/
raise ValueError("setUp was not called")
ValueError: setUp was not called
------------
=======
ERROR: bzrlib.
-------
_StringException: Text attachment: traceback
------------
Traceback (most recent call last):
File "/usr/lib/
return fn(*args)
File "/usr/lib/
raise ValueError("setUp was not called")
ValueError: setUp was not called
------------
-------
I think Vincent was right that your class needs to be calling super().setUp()
I think the issue is that if the base class is using super() then this class needs to use super(). If the child is using ParentClass.
- 5325. By Canonical.com Patch Queue Manager <email address hidden> on 2010-06-28
-
(Martin von Gagern) Deal with branch: revision specs in readonly
transactions - 5326. By Canonical.com Patch Queue Manager <email address hidden> on 2010-06-30
-
(vila) Cleanup tests importing get_transport. (Vincent Ladeuil)
- 5327. By Canonical.com Patch Queue Manager <email address hidden> on 2010-06-30
-
(jameinel) locking for cmd_ignore is now in add_cleanup. (Parth Malwankar)
- 5328. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-01
-
(spiv) Fix Branch._unstack to work with repeatedly locked RemoteBranch
objects. (#551525) (Andrew Bennetts) - 5329. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-01
-
(parthm) fixed import order of lazy_regex w.r.t _format_
version_ tuple
definition in bzrlib (Parth Malwankar) - 5330. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-02
-
(jameinel) fixed trace import in bzrlib_initialize (Parth Malwankar)
- 5331. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-03
-
(jameinel) a couple of doc cleanups about the ppa (Martin Pool)
- 5332. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-04
-
(lifeless) Make lsprof usage serialise rather than generated corrupted
results when used concurrently in a threaded application. Can now cause
deadlocks when used reentrantly. (Robert Collins) - 5333. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-04
-
(gz) Make windows installer use a 2 second resolution for plugin script
timestamps to avoid recompilation at runtime (Martin [gz]) - 5334. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-05
-
(lifeless) Fix regression from r5326 that caused infinite recursion in
osutils._win32_ mkdtemp (Martin [gz]) - 5335. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-05
-
(lifeless) Remove duplicate test get_parent_
map_after_ insert_ stream. (Robert
Collins) - 5336. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-06
-
(lifeless) Document the basedir on WorkingTree. (Robert Collins)
- 5337. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-07
-
(mbp) developer docs about testing (Martin Pool)
- 5338. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-07
-
(jameinel) Use a better list of PyQt includes and excludes. (Gary van der
Merwe) - 5339. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-08
-
(parthm) Better regex compile errors (Parth Malwankar)
- 5340. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-09
-
(jameinel) Rename errors.
InvalidPattern argument message=>msg to work with
multiple Python versions. (Parth Malwankar) - 5341. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-12
-
(jam) Merge 2.2b4 to dev, bump the version numbers.
- 5342. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-13
-
(jam) Bump trunk to 2.3-dev1
| Martin Pool (mbp) wrote : | # |
sent to pqm by email
- 5343. By Canonical.com Patch Queue Manager <email address hidden> on 2010-07-13
-
(mbp) change some test tearDowns to addCleanup or overrideAttr (Martin Pool)

24 + saved_user_encoding = osutils. _cached_ user_encoding _cached_ user_encoding = saved_user_encoding (restore_ stuff)
25 + saved_stdout = sys.stdout
26 + def restore_stuff():
27 + osutils.
28 + sys.stdout = saved_stdout
29 + self.addCleanup
You missed the even simpler:
self.overrideAt tr(sys, 'stdout') tr(osutils. _cached_ user_encoding)
self.overrideAt
which will set an illegal value that could even catch invalid tests there.
And looking at the tests, you don't even need to override sys.stdout anyway.
Hmm, your branch seems to be based on a bzr version that doesn't provide overrideAttr,
yet you target bzr.dev, is that really wanted ?
=== modified file 'bzrlib/ tests/test_ http.py'
Same remarks, plus it will conflict with my lealing-tests proposal, but I'll handle the conflicts there (I've addressed the same problem :)
This is still better than what we have so feel free to land whatever version you want, my vote is optional Tweak here :)