Merge lp:~diegosarmentero/ubuntuone-client/fix-user-home-tests into lp:ubuntuone-client
Proposed by
Diego Sarmentero
Status: | Merged |
---|---|
Approved by: | Natalia Bidart |
Approved revision: | 1187 |
Merged at revision: | 1182 |
Proposed branch: | lp:~diegosarmentero/ubuntuone-client/fix-user-home-tests |
Merge into: | lp:ubuntuone-client |
Diff against target: |
357 lines (+13/-71) 13 files modified
contrib/testing/testcase.py (+4/-5) tests/platform/linux/eventlog/test_zg_listener.py (+0/-14) tests/platform/linux/test_filesystem_notifications.py (+0/-1) tests/platform/linux/test_vm.py (+4/-2) tests/platform/test_filesystem_notifications.py (+0/-1) tests/platform/test_os_helper.py (+3/-6) tests/platform/test_tools.py (+0/-3) tests/syncdaemon/test_action_queue.py (+1/-13) tests/syncdaemon/test_eq_inotify.py (+0/-4) tests/syncdaemon/test_eventqueue.py (+0/-1) tests/syncdaemon/test_localrescan.py (+0/-14) tests/syncdaemon/test_main.py (+1/-0) tests/syncdaemon/test_vm.py (+0/-7) |
To merge this branch: | bzr merge lp:~diegosarmentero/ubuntuone-client/fix-user-home-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Brian Curtin (community) | Approve | ||
Review via email: mp+88919@code.launchpad.net |
Commit message
- Fixed: tests are now not modifying the real user home (LP: #915380).
Description of the change
Just some fixes in the tests.
To post a comment you must log in.
* Though FakeMainTestCase used to use self.tmpdir as homke dir, it is more correct to use a dedicated dir for that, so we can isolate home data into a dir (we may need that to debug a test).
Can you please make self.home_dir = self.mktemp( 'ubuntuonehacke r')?
* Also, in tests/syncdaemo n/test_ action_ queue.py you're removing the patch os.environ['HOME'] = self.home, which is great, but the self.home variable should point to the same home that the base test case is using to patch the xdg_home var. So, I would guess that in BasicTestCase we need to change:
self.home = self.mktemp('home')
for
self.home = self.home_dir
(please confirm this makes sense before changing it, I did not reviewed the whole test module).
* There are several tests that are re-defining self.home_dir and re-patching xdg_home... can you please remove that? (we need to confirm they all inherit from BaseTwistedTestCase either directly or by some inheritance chain). A quick grep gives me:
nessita@ dali:~/ canonical/ client/ review_ fix-user- home-tests$ grep -rn --color "patch.*xdg_home" * testing/ testcase. py:383: self.patch( platform, "xdg_home", self.home_dir) n/test_ localrescan. py:134: self.patch( platform, 'xdg_home', self.home_dir) n/test_ localrescan. py:374: self.patch( platform, 'xdg_home', self.home_dir) n/test_ localrescan. py:2021: self.patch( platform, 'xdg_home', self.home_dir) n/test_ localrescan. py:2260: self.patch( platform, 'xdg_home', self.home_dir) n/test_ config. py:534: self.patch( platform, 'xdg_home', homedir) n/test_ main.py: 267: self.patch( main_mod, "xdg_home", self.home_dir) n/test_ eq_inotify. py:664: self.patch( platform, 'xdg_home', self.home_dir) test_os_ helper. py:95: self.patch( platform, "xdg_home", self.my_home) dali:~/ canonical/ client/ review_ fix-user- home-tests$
contrib/
tests/syncdaemo
tests/syncdaemo
tests/syncdaemo
tests/syncdaemo
tests/syncdaemo
tests/syncdaemo
tests/syncdaemo
tests/platform/
nessita@
nessita@ dali:~/ canonical/ client/ review_ fix-user- home-tests$ grep -rn --color "self\.home_dir =" * testing/ testcase. py:382: self.home_dir = self.tmpdir n/test_ vm.py:3739: self.home_dir = self.mktemp( 'ubuntuonehacke r') n/test_ localrescan. py:126: self.home_dir = self.mktemp( 'ubuntuonehacke r') n/test_ eventqueue. py:46: self.home_dir = self.mktemp( 'home_dir' ) n/test_ eq_inotify. py:649: self.home_dir = self.mktemp( 'ubuntuonehacke r') linux/test_ vm.py:464: self.home_dir = os.path. join(self. tmpdir, 'home', 'ubuntuonehacker') linux/test_ filesystem_ notifications. py:102: self.home_dir = self.mktemp( 'home_dir' ) test_filesystem _notifications. py:102: self.home_dir = self.mktemp( 'home_dir' ) dali:~/ canonical/ client/ review_ fix-user- home-tests$
contrib/
tests/syncdaemo
tests/syncdaemo
tests/syncdaemo
tests/syncdaemo
tests/platform/
tests/platform/
tests/platform/
nessita@