Merge lp:~mikemc/ubuntuone-client/find-logging-conf into lp:ubuntuone-client

Proposed by Mike McCracken on 2012-10-17
Status: Merged
Approved by: Brian Curtin on 2012-10-18
Approved revision: 1346
Merged at revision: 1347
Proposed branch: lp:~mikemc/ubuntuone-client/find-logging-conf
Merge into: lp:ubuntuone-client
Diff against target: 46 lines (+11/-7)
2 files modified
tests/syncdaemon/test_config.py (+9/-6)
ubuntuone/syncdaemon/config.py (+2/-1)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-client/find-logging-conf
Reviewer Review Type Date Requested Status
Brian Curtin (community) Approve on 2012-10-18
Michał Karnicki (community) Approve on 2012-10-18
Roberto Alsina (community) 2012-10-17 Approve on 2012-10-17
Review via email: mp+130036@code.launchpad.net

Commit Message

- Use file-relative path for logging.conf to find it in u1-client tree even when CWD is outside. (LP: #1067489)

Description of the Change

- Use file-relative path for logging.conf to find it in u1-client tree even when CWD is outside. (LP: #1067489)

This is only a problem when running from source on windows or darwin without having previously installed the app (windows) or run the bundled .app (darwin).
If you've done that, then logging.conf is in the default place and it'll find it there without having to fall back to the incorrect relative path 'data/logging.conf' that it currently generates.

This branch also moves the test that checks this property to a different test case subclass, because the current one patches get_config_files, so we ended up testing the patched lambda with test data.

TO TEST: run the test suite (or just test_config.py)
IRL TEST: make sure you don't have logging.conf in the installed location then try running control panel from source. it'll hang forever waiting for syncdaemon which keeps dying with a message about logging_level.

To post a comment you must log in.
Roberto Alsina (ralsina) :
review: Approve
Michał Karnicki (karni) :
review: Approve
Brian Curtin (brian.curtin) wrote :

Tests work for me. Also approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_config.py'
2--- tests/syncdaemon/test_config.py 2012-07-19 14:16:59 +0000
3+++ tests/syncdaemon/test_config.py 2012-10-17 06:56:41 +0000
4@@ -435,12 +435,6 @@
5 conf_1 = config._Config(conf_file)
6 self.assertEquals(True, conf_1.get_show_all_notifications())
7
8- def test_load_branch_configuration(self):
9- """Check that the configuration from the branch is loaded."""
10- config_files = config.get_config_files()
11- rootdir = os.environ['ROOTDIR']
12- branch_config = os.path.join(rootdir, "data", config.CONFIG_FILE)
13- self.assertIn(branch_config, config_files)
14
15 def test_get_simult_transfers(self):
16 """Get simult transfers."""
17@@ -516,7 +510,16 @@
18 branch_config = os.path.join(fake_path, config.CONFIG_FILE)
19 self.assertIn(branch_config, config_files)
20
21+ def test_load_branch_configuration(self):
22+ """Check that the configuration from the branch is loaded."""
23+ config_files = [os.path.normpath(p) for p in config.get_config_files()]
24+ rootdir = os.environ['ROOTDIR']
25+ branch_config = os.path.join(rootdir, "data", config.CONFIG_FILE)
26+ branch_logging_config = os.path.join(rootdir, "data", config.CONFIG_LOGS)
27+ self.assertIn(branch_config, config_files)
28+ self.assertIn(branch_logging_config, config_files)
29
30+
31 class ConfigglueParsersTests(BaseTwistedTestCase):
32 """Tests for our custom configglue parsers."""
33
34
35=== modified file 'ubuntuone/syncdaemon/config.py'
36--- ubuntuone/syncdaemon/config.py 2012-07-19 14:16:59 +0000
37+++ ubuntuone/syncdaemon/config.py 2012-10-17 06:56:41 +0000
38@@ -183,7 +183,8 @@
39 if os.path.exists(config_file):
40 config_files.append(config_file)
41
42- config_logs = os.path.join('data', CONFIG_LOGS)
43+ config_logs = os.path.join(os.path.dirname(__file__), os.path.pardir,
44+ os.path.pardir, 'data', CONFIG_LOGS)
45 if os.path.exists(config_logs):
46 config_files.append(config_logs)
47

Subscribers

People subscribed via source and target branches