Merge lp:~bjornt/launchpad/more-unique-factory-strings into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Graham Binns |
Approved revision: | no longer in the source branch. |
Merged at revision: | 10887 |
Proposed branch: | lp:~bjornt/launchpad/more-unique-factory-strings |
Merge into: | lp:launchpad |
Diff against target: |
20 lines (+2/-1) 1 file modified
lib/lp/testing/factory.py (+2/-1) |
To merge this branch: | bzr merge lp:~bjornt/launchpad/more-unique-factory-strings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+25438@code.launchpad.net |
Description of the change
Make LaunchpadObject
Currently LaunchpadObject
an instance. This is fine for tests, but not so good when using it to
generate test data for manual testing. I've often run into the situation
where I use the object factory to generate a number of objects in a
script. After a while I want to generate more objects, but it fails,
since the it tries to use the same names as before. With this change
it's quite unlikely that it will use the same names twice, even though
there's still a small risk. If we see a test failing due to this, we can
quite easily make sure that it's really unique within an instance, by
keeping track of generated uuids.
One benefit of this change is that it makes sure that people don't
hardcode automatically generated names in the tests. I might have to fix
some existing tests; I've not finished running the test suite yet.
2010/5/17 Björn Tillenius <email address hidden>:
> If we see a test failing due to this, we can
> quite easily make sure that it's really unique within an instance, by
> keeping track of generated uuids.
>
Or you could drop the uuid approach and simply put id(self) into the r()-generated segment.
string before the getUniqueIntege
jml