Merge lp:~mvo/software-center/recommender_uuid_consolidation into lp:software-center
Status: | Rejected |
---|---|
Rejected by: | Michael Vogt |
Proposed branch: | lp:~mvo/software-center/recommender_uuid_consolidation |
Merge into: | lp:software-center |
Diff against target: |
169 lines (+51/-39) 4 files modified
softwarecenter/backend/recagent.py (+31/-13) softwarecenter/ui/gtk3/app.py (+0/-26) softwarecenter/ui/gtk3/widgets/recommendations.py (+7/-0) test/test_recagent.py (+13/-0) |
To merge this branch: | bzr merge lp:~mvo/software-center/recommender_uuid_consolidation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Lasker (community) | Needs Fixing | ||
Review via email: mp+95322@code.launchpad.net |
Description of the change
This branch does some cleanup in the way we store the recommender_uuid.
All usage from app.py is removed as its currently not used or needed there. We only use it to write it in the config
but that can be done in the recagent.py as well.
The RecommenderAgen
SoftwareCenterC
value.
Plus a test to ensure that the property is calling the SoftwareCenterC
Unmerged revisions
- 2799. By Michael Vogt
-
REFACTOR: remove recommender_uuid from app.py as it does not need to know about this (the widget is self contained currently and the state can set set using the global get_config() config that will saved on s-c exit); also make recommender_uuid a property so that reads/writes are automatically stored in the global s-c config
Hi mvo, thanks for this! I think it's a good idea to consolidate the UUID stuff more, however, there are two reasons why I left the connection to app.py (with the signal). The first is because I planned to add an opt-out menu item (which will be a dead-simple change). The second is that I thought it best to keep all of the code that writes to the main config file in one place, that is, in app.py. Else somebody else will have to search if they want to explain where this mysterious other field is coming from in the main config file.
In any case, I am seeing two problems with it the current branch. One is a failure in the unit test, the other occurs when running the app itself (specifically, soemthing that would occur during a first run in a new install, further details below).
First, the unit test:
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= recagent_ post_submit_ profile (__main_ _.TestRecommend erAgent) ------- ------- ------- ------- ------- ------- ------- ------- ------- recagent_ post_submit_ profile _agent. post_submit_ profile( db) tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ backend/ recagent. py", line 98, in post_submit_profile recommender_ uuid = get_uuid() tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ backend/ recagent. py", line 236, in _set_recommende r_uuid set("general" , "recommender_uuid", self.recommende r_uuid) python2. 7/ConfigParser. py", line 753, in set r.set(self, section, option, value) python2. 7/ConfigParser. py", line 396, in set section)
ERROR: test_mocked_
-------
Traceback (most recent call last):
File "test_recagent.py", line 48, in test_mocked_
recommender
File "/home/
self.
File "/home/
config.
File "/usr/lib/
ConfigParse
File "/usr/lib/
raise NoSectionError(
NoSectionError: No section: 'general'
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= recommender_ uuid_property (__main_ _.TestRecommend erAgent) ------- ------- ------- ------- ------- ------- ------- ------- ------- recommender_ uuid_property assertEqual( recommender_ agent.recommend er_uuid, "foxy-uuid")
FAIL: test_recagent_
-------
Traceback (most recent call last):
File "test_recagent.py", line 161, in test_recagent_
self.
AssertionError: '' != 'foxy-uuid'
------- ------- ------- ------- ------- ------- ------- ------- ------- -------
Ran 7 tests in 6.296s
FAILED (failures=1, errors=1)
---
And the failure with the app itself occurs in the case where we have not yet made the cfg file (you can see this with a 'rm .config/ software- center/ softwarecenter. cfg'). This would happen on first run of software-center for a new install, for instance, and if the user opt-in to recommendations then. What happens in the UI is that the "Uploading user profile" spinner hangs.
Traceback (most recent call last): tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ ui/gtk3/ widgets/ recommendations .py", line 127, in _on_opt_ in_button_ clicked _upload_ user_profile_ and_get_ recommendations () tremolux/ Projects/ precis. ..
File "/home/
self.
File "/home/