Merge lp:~michael.nelson/ubuntu-webcatalog/777871-pull-other-apps-from-apt-cache into lp:ubuntu-webcatalog
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Danny Tamez | ||||
Approved revision: | 36 | ||||
Merged at revision: | 18 | ||||
Proposed branch: | lp:~michael.nelson/ubuntu-webcatalog/777871-pull-other-apps-from-apt-cache | ||||
Merge into: | lp:ubuntu-webcatalog | ||||
Diff against target: |
319 lines (+164/-38) 3 files modified
django_project/settings.py (+1/-0) src/webcatalog/management/commands/import_app_install_data.py (+36/-14) src/webcatalog/tests/test_commands.py (+127/-24) |
||||
To merge this branch: | bzr merge lp:~michael.nelson/ubuntu-webcatalog/777871-pull-other-apps-from-apt-cache | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danny Tamez (community) | Approve | ||
Review via email: mp+64977@code.launchpad.net |
Commit message
Enables tests to run in under 3 seconds (rather than 35) by using a mock apt-cache, and uses lucid-compat cache update.
Description of the change
Overview
========
This branch doesn't do what the name implies, it was going to, but got sidetracked ;)
This branch updates the tests so that they run fast again (each of the command tests was doing an apt-cache update taking 3-4 seconds), for me 35secs in total, back so that they run in under 3 seconds. I've done this by adding a mock apt-cache for the tests, but also included a switch so you can run the tests against the real apt-cache if we need to.
It also updates the creation of the on-disk apt caches so that they are only created if they don't already exist, otherwise updated.
Details
=======
After chatting with mvo:
11:54 < noodles> mvo: hi! For the web catalog, we're currently doing: cache.update(
11:55 < noodles> to create a cache for whichever distroseries we need... but it seems that doesn't work on lucid:
11:55 < noodles> https:/
11:55 < noodles> Is there a way to get the same effect on lucid?
11:55 < mvo> noodles: yes
11:56 < mvo> noodles: its best to use "cache = apt.Cache(
11:56 < mvo> noodles: you can keep this dir then, i.e. instead of making it a temp one make it permanent
11:57 < mvo> noodles: this will speed up the process of updates as it will use the binary cache in there and also use if-modified-since when doing the cache.update()
11:57 < mvo> noodles: and it will work on lucid :)
11:57 < noodles> Oh, we're already setting the rootdir, was the sources_list unecessary.. OK.
11:57 < noodles> Ah, sweet, I'll update it to do that then. Thanks!
I updated the on-disk cache to be more permanent (created if it doesn't exist, but otherwise just updated).
To test: follow the readme to bootstrap, then `fab test`
Much much faster. Works great.