Merge lp:~dobey/ubuntuone-dev-tools/fix-src-config into lp:ubuntuone-dev-tools

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 15
Merged at revision: 18
Proposed branch: lp:~dobey/ubuntuone-dev-tools/fix-src-config
Merge into: lp:ubuntuone-dev-tools
Diff against target: 42 lines (+15/-2)
2 files modified
ubuntuone/devtools/services/dbus.py (+4/-2)
ubuntuone/devtools/services/tests/test_dbus.py (+11/-0)
To merge this branch: bzr merge lp:~dobey/ubuntuone-dev-tools/fix-src-config
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Manuel de la Peña (community) Approve
Review via email: mp+44482@code.launchpad.net

Commit message

Fix the missing comma and use abspath to get the full path
Add a test to ensure the config file is loaded from the correct place in tests

To post a comment you must log in.
Revision history for this message
Manuel de la Peña (mandel) wrote :

+1

review: Approve
15. By dobey

Use os.path.pardir instead of ..

Revision history for this message
Natalia Bidart (nataliabidart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/devtools/services/dbus.py'
2--- ubuntuone/devtools/services/dbus.py 2010-11-03 21:04:06 +0000
3+++ ubuntuone/devtools/services/dbus.py 2010-12-22 19:04:50 +0000
4@@ -45,8 +45,10 @@
5 def _find_config_file(self):
6 """Find the first appropriate dbus-session.conf to use."""
7 # In case we're running from within the source tree
8- path = os.path.join(os.path.dirname(__file__), "..", "..", ".."
9- "data", "dbus-session.conf")
10+ path = os.path.abspath(os.path.join(os.path.dirname(__file__),
11+ os.path.pardir, os.path.pardir,
12+ os.path.pardir,
13+ "data", "dbus-session.conf"))
14 if os.path.exists(path):
15 return path
16
17
18=== modified file 'ubuntuone/devtools/services/tests/test_dbus.py'
19--- ubuntuone/devtools/services/tests/test_dbus.py 2010-11-03 21:04:06 +0000
20+++ ubuntuone/devtools/services/tests/test_dbus.py 2010-12-22 19:04:50 +0000
21@@ -2,6 +2,7 @@
22
23 import os
24 from ubuntuone.devtools.testcase import DBusTestCase
25+from ubuntuone.devtools.services.dbus import DBusRunner
26
27
28 class TestWithDBus(DBusTestCase):
29@@ -13,3 +14,13 @@
30 self.assertTrue(
31 bus_address.startswith('unix:abstract=%s' % os.path.dirname(
32 os.getcwd())))
33+
34+ def test_config_file_path(self):
35+ """Test that we loaded the config file from the local tree."""
36+ expected = os.path.abspath(os.path.join(
37+ os.path.dirname(__file__),
38+ os.path.pardir, os.path.pardir, os.path.pardir, os.path.pardir,
39+ 'data', 'dbus-session.conf'))
40+ runner = DBusRunner()
41+ # pylint: disable=W0212
42+ self.assertEqual(expected, runner._find_config_file())

Subscribers

People subscribed via source and target branches

to all changes: