Merge lp:~jtv/launchpad/bug-819674 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | William Grant | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 13618 | ||||
Proposed branch: | lp:~jtv/launchpad/bug-819674 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
109 lines (+75/-6) 2 files modified
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+14/-6) lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+61/-0) |
||||
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-819674 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+70135@code.launchpad.net |
Commit message
[r=wgrant][bug=819674] Make sure publish-ftpmaster handles ctrl-C.
Description of the change
= Summary =
If you hit ctrl-C while running publish-ftpmaster, the sensible thing happens: the only parts of the filesystem that are affected are the archive pool (which may get some extra files but won't reference them yet), and the working dists directory (which won't become the current dists directory until success).
This wasn't fully tested, so here goes.
I tried to do this the proper TDD way, and then found that the only real code change I needed was to make this behaviour testable. Then I discovered that the "except:" catches not just Exceptions but KeyboardInterrupts as well (the latter is no longer derived from the former in recent python versions). But I believe the tests are still useful.
I used FakeMethods in two of their four capacities here:
1. To force a method into raising a specific failure.
2. To keep track of calls to a method.
(The other two, which I did not use here, are to turn a modifying method into a no-op and to force a querying method into returning a specific value).
The actual work done by recoverWorkingDists (including its integration with the newly extracted recoverArchiveW
== Tests ==
{{{
./bin/test -vvc lp.archivepubli
}}}
== Demo and Q/A ==
Ongoing: make sure the new python-based publish-ftpmaster script works well enough to replace the old shell script in production.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
As discussed on IRC, I'd like to see assertRaisesWit hContent to simplify two of those tests.