Merge lp:~james-w/launchpad/no-more-sampledata-2 into lp:launchpad
| Status: | Work in progress |
|---|---|
| Proposed branch: | lp:~james-w/launchpad/no-more-sampledata-2 |
| Merge into: | lp:launchpad |
| Prerequisite: | lp:~james-w/launchpad/soyuz-factory-improvements |
| Diff against target: |
1355 lines (+305/-266) 15 files modified
lib/lp/archivepublisher/tests/test_publisher.py (+0/-6) lib/lp/archiveuploader/tests/nascentupload-ddebs.txt (+2/-0) lib/lp/soyuz/doc/archive-files.txt (+5/-1) lib/lp/soyuz/doc/packageupload-lookups.txt (+3/-1) lib/lp/soyuz/doc/publishing.txt (+41/-18) lib/lp/soyuz/doc/sourcepackagerelease.txt (+8/-5) lib/lp/soyuz/scripts/tests/test_changeoverride.py (+13/-6) lib/lp/soyuz/scripts/tests/test_copypackage.py (+52/-54) lib/lp/soyuz/scripts/tests/test_publishdistro.py (+5/-13) lib/lp/soyuz/tests/test_binarypackagebuild.py (+3/-3) lib/lp/soyuz/tests/test_publish_archive_indexes.py (+51/-21) lib/lp/soyuz/tests/test_publishing.py (+102/-124) lib/lp/soyuz/tests/test_publishing_top_level_api.py (+0/-2) lib/lp/testing/factory.py (+9/-12) lib/lp/testing/tests/test_factory.py (+11/-0) |
| To merge this branch: | bzr merge lp:~james-w/launchpad/no-more-sampledata-2 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Jonathan Lange (community) | Approve on 2010-08-12 | ||
| Abel Deuring (community) | code | 2010-08-05 | Approve on 2010-08-06 |
|
Review via email:
|
|||
Commit Message
The SoyuzTestPublisher now uses the factory. The main difference for now is that you are more likely to get a proxied object from it.
Description of the Change
Hi,
Apologies for the bumper branch. Very small changes snowballed
very quickly.
This branch moves SoyuzTestPublisher to back on to the
factory, as a precursor to moving it away from sampledata.
It now runs pretty much the same code inside the factory as it
was running before, and now SoyuzTestPublisher is just a layer
on top of the factory with some conveniences for complex
tests.
The major change is that there are now lots more proxied objects
in soyuz tests, so most of the changes are fallout from that.
There's a lot of removeSecurityProxy involved there, as most of
the problems we in test setup code that is reaching around the
interface to do test set up. I'm not entirely happy that we have
to do that, they should be able to come in by the front door, but
fixing all of that would be too much for one branch.
There's also a bit of having the tests specify the parameters
for the creation of objects where they will assert something
based on that parameter. I didn't do that across the board though.
Plus there are a few drive-by fixes and cleanups as always.
Breakdown of the changes, as not all are immediately obvious. It's perhaps
best to review in reverse order of the changes listed here (odd that bzr
diff gave me the files in roughly reverse order).
lib/lp/
lib/lp/
on the interface.
lib/lp/
requires the extra setup that only used to be done later.
lib/lp/
if there were an appropriate way to do that. It's just set up though, so this has the
same effect.
lib/lp/
what is expected.
lib/lp/
component isn't possible, but you could republish in the new component.
lib/lp/
cleanup, so we don't care.
lib/lp/
version of a publication, which isn't normally allowed.
lib/lp/
interface for test setup.
lib/lp/
listify each of them.
lib/lp/
a case of forcing invalid data in to a field. I also deleted some copy paste comments
that made no sense in the context.
lib/lp/
from the fallout of this due to the proxy.
Thanks,
James
| Jonathan Lange (jml) wrote : | # |
| James Westby (james-w) wrote : | # |
Thanks for the review.
> Most of the review comments are about dropping calls to sync()
> entirely and adding comments to certain calls to removeSecurityProxy –
> it's good to know why a test feels the need to fiddle with internals.
wgrant said pretty much the same things too, I'm going to take a bit
more time to try and do things more cleanly.
> Also, I feel obliged to include this snippet of a conversation I had
> with Julian, in case they are relevant to this patch or trigger new
> thinking about the no-more-sampledata work you've been doing.
>
> #launchpad-code, 2010-08-03, 16:13-16:19:
> <bigjools> jml: I'm a bit uncomfortable with the factory changes to skip STP
> <jml> bigjools, why so?
> <bigjools> jml: a few reasons. One, because it's not differentiating
> between binary and source publications. Two, someone will want to make
> it do binaries at some point and there will be pain because they're an
> order of magnitiude more complicated to set up, and three, the STP
> relies on sample data because there's a load of publisher config in it
> which is not being set up in the factory methods so you can end up
> with data
> <bigjools> that can't exist in the real world.
> <bigjools> and probably more problems if I look harder
> <bigjools> not insurmountable of course, but nonetheless the problems exist
I saw this conversation. I'm keen to solve these problems such that the
factory is sufficient, but I don't know of many concrete cases where the
sampledata is different, one of the problems of sampledata.
One thing I know is that lucilleconfig isn't set on factory created
distributions and distroseries, and I am working on a way to deal
with that. That's an issue where your tests won't run, rather than
testing the wrong thing though.
Thanks,
James
| Abel Deuring (adeuring) wrote : | # |
Hi James,
again, a nice branch!
Just one minor remark:
> @@ -540,7 +518,8 @@
> for pub in pubs:
> self.checkPastD
> if supersededby is not None:
> - if isinstance(pub, BinaryPackagePu
> + if isinstance(
> + removeSecurityP
> dominant = supersededby.
> else:
> dominant = supersededby.
I think this is one occasion where you don't need to call removeSecurityP
| Francis J. Lacoste (flacoste) wrote : | # |
On August 6, 2010, Abel Deuring wrote:
> Review: Approve code
> Hi James,
>
> again, a nice branch!
>
> Just one minor remark:
> > @@ -540,7 +518,8 @@
> >
> > for pub in pubs:
> > self.checkPastD
> >
> > if supersededby is not None:
> > - if isinstance(pub, BinaryPackagePu
> > + if isinstance(
> >
> > + removeSecurityP
BinaryPackagePu
> > dominant = supersededby.
> >
> > else:
> > dominant = supersededby.
>
> I think this is one occasion where you don't need to call
> removeSecurityP
> isinstance() so that a possibly existing security proxy is removed before
> the "real" isinstance function is called.
It doesn't monkeypatch by default, but it is common to shadow it by importing
from zope.security.proxy import isinstance
And that one will do the right thing.
--
Francis J. Lacoste
<email address hidden>
- 11319. By James Westby on 2010-08-06
-
Merged soyuz-factory-
improvements into no-more- sampledata- 2. - 11320. By James Westby on 2010-08-06
-
Drop all the calls to sync, as they are now unnecessary.
- 11321. By James Westby on 2010-08-06
-
Document why we rSP the package diff.
- 11322. By James Westby on 2010-08-06
-
Avoid rSP by logging in as the owner.
- 11323. By James Westby on 2010-08-06
-
Avoid an rSP by passing dsc_binaries to getPubSource.
- 11324. By James Westby on 2010-08-06
-
Remove more uses of rSP by changing the setup to allow specifying the needed values.
Also use zope's isinstance rather than the builtin one to avoid the proxy.
- 11325. By James Westby on 2010-08-06
-
Comment why we are calling removeSecurityProxy when printing.
- 11326. By James Westby on 2010-08-06
-
Avoid changing the purpose of an existing archive.
- 11327. By James Westby on 2010-08-06
-
Avoid another rSP by improving the test publisher.
Also add a couple of comments where rSP is unavoidable.
- 11328. By James Westby on 2010-08-06
-
Remove the last of the rSP with some reorganisation.
- 11329. By James Westby on 2010-08-06
-
Damn, missed one that required a comment.
| James Westby (james-w) wrote : | # |
Hi,
Please review again.
All should be much rosier now.
Some of the changes are now more complex, as I opted to
restructure some things rather than using
removeSecurityP
Thanks,
James
- 11330. By James Westby on 2010-08-06
-
Merge devel.
| Jonathan Lange (jml) wrote : | # |
Looks good. There are a few comments that aren't correctly punctuated sentences, but since I don't care enough to enumerate them, you needn't bother to fix them. :)
- 11331. By James Westby on 2010-08-12
-
Merge devel.
- 11332. By James Westby on 2010-08-16
-
Merge improve-
soyuz-factory in to no-more- sampledata- 2.
| Brad Crittenden (bac) wrote : | # |
James is this branch ready to land? Is there any way I can assist you in landing the several approved branches?
Unmerged revisions
- 11332. By James Westby on 2010-08-16
-
Merge improve-
soyuz-factory in to no-more- sampledata- 2. - 11331. By James Westby on 2010-08-12
-
Merge devel.
- 11330. By James Westby on 2010-08-06
-
Merge devel.
- 11329. By James Westby on 2010-08-06
-
Damn, missed one that required a comment.
- 11328. By James Westby on 2010-08-06
-
Remove the last of the rSP with some reorganisation.
- 11327. By James Westby on 2010-08-06
-
Avoid another rSP by improving the test publisher.
Also add a couple of comments where rSP is unavoidable.
- 11326. By James Westby on 2010-08-06
-
Avoid changing the purpose of an existing archive.
- 11325. By James Westby on 2010-08-06
-
Comment why we are calling removeSecurityProxy when printing.
- 11324. By James Westby on 2010-08-06
-
Remove more uses of rSP by changing the setup to allow specifying the needed values.
Also use zope's isinstance rather than the builtin one to avoid the proxy.
- 11323. By James Westby on 2010-08-06
-
Avoid an rSP by passing dsc_binaries to getPubSource.

On Thu, Aug 5, 2010 at 10:00 PM, James Westby <email address hidden> wrote:
...
> Hi,
>
> Apologies for the bumper branch. Very small changes snowballed
> very quickly.
It happens.
> This branch moves SoyuzTestPublisher to back on to the
> factory, as a precursor to moving it away from sampledata.
>
> It now runs pretty much the same code inside the factory as it
> was running before, and now SoyuzTestPublisher is just a layer
> on top of the factory with some conveniences for complex
> tests.
>
This seems like a sensible approach.
> The major change is that there are now lots more proxied objects
> in soyuz tests, so most of the changes are fallout from that.
> There's a lot of removeSecurityProxy involved there, as most of
> the problems we in test setup code that is reaching around the
> interface to do test set up. I'm not entirely happy that we have
> to do that, they should be able to come in by the front door, but
> fixing all of that would be too much for one branch.
>
Agreed.
... archivepublishe r/tests/ test_dominator. py - just making the values explicit. archivepublishe r/tests/ test_publisher. py, lib/lp/ soyuz/scripts/ tests/test_ publishdistro. py, lib/lp/ soyuz/tests/ test_publishing _top_level_ api.py - using sync() from SQLObject, which isn't archiveuploader /tests/ nascentupload- ddebs.txt - getPubSource now creates a user, which soyuz/doc/ archive- files.txt - setting a value that could be set at creation time soyuz/doc/ packageupload- lookups. txt - Using rSP to ensure that the repr is soyuz/doc/ publishing. txt - changing purpose of an archive or parent series aren't normally allowed. New archives/series could be created instead. Changing the published soyuz/doc/ sourcepackagere lease.txt - deletion is protected, but this is just test soyuz/scripts/ tests/test_ changeoverride. py - specifying values and changing the soyuz/scripts/ tests/test_ copypackage. py - various instances of bypassing the soyuz/tests/ test_binarypack agebuild. py - the proxy stops you concatenating lists, so soyuz/tests/ test_publish_ archive_ indexes. py - specify all the tested values. Also soyuz/tests/ test_publishing .py - the big one, using the factory and lp.testing. sampledata rather than creating objects itself, then a whole bunch of fixes
> Breakdown of the changes, as not all are immediately obvious. It's perhaps
> best to review in reverse order of the changes listed here (odd that bzr
> diff gave me the files in roughly reverse order).
>
> lib/lp/
>
> lib/lp/
> on the interface.
>
> lib/lp/
> requires the extra setup that only used to be done later.
>
> lib/lp/
> if there were an appropriate way to do that. It's just set up though, so this has the
> same effect.
>
> lib/lp/
> what is expected.
>
> lib/lp/
> component isn't possible, but you could republish in the new component.
>
> lib/lp/
> cleanup, so we don't care.
>
> lib/lp/
> version of a publication, which isn't normally allowed.
>
> lib/lp/
> interface for test setup.
>
> lib/lp/
> listify each of them.
>
> lib/lp/
> a case of forcing invalid data in to a field. I also deleted some copy paste comments
> that made no sense in the context.
>
> lib/lp/
> from the fallout of this due to the proxy.
>
> Thanks,
>
My pleasure....