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
=== modified file 'ubuntuone/devtools/services/dbus.py'
--- ubuntuone/devtools/services/dbus.py 2010-11-03 21:04:06 +0000
+++ ubuntuone/devtools/services/dbus.py 2010-12-22 19:04:50 +0000
@@ -45,8 +45,10 @@
45 def _find_config_file(self):45 def _find_config_file(self):
46 """Find the first appropriate dbus-session.conf to use."""46 """Find the first appropriate dbus-session.conf to use."""
47 # In case we're running from within the source tree47 # In case we're running from within the source tree
48 path = os.path.join(os.path.dirname(__file__), "..", "..", ".."48 path = os.path.abspath(os.path.join(os.path.dirname(__file__),
49 "data", "dbus-session.conf")49 os.path.pardir, os.path.pardir,
50 os.path.pardir,
51 "data", "dbus-session.conf"))
50 if os.path.exists(path):52 if os.path.exists(path):
51 return path53 return path
5254
5355
=== modified file 'ubuntuone/devtools/services/tests/test_dbus.py'
--- ubuntuone/devtools/services/tests/test_dbus.py 2010-11-03 21:04:06 +0000
+++ ubuntuone/devtools/services/tests/test_dbus.py 2010-12-22 19:04:50 +0000
@@ -2,6 +2,7 @@
22
3import os3import os
4from ubuntuone.devtools.testcase import DBusTestCase4from ubuntuone.devtools.testcase import DBusTestCase
5from ubuntuone.devtools.services.dbus import DBusRunner
56
67
7class TestWithDBus(DBusTestCase):8class TestWithDBus(DBusTestCase):
@@ -13,3 +14,13 @@
13 self.assertTrue(14 self.assertTrue(
14 bus_address.startswith('unix:abstract=%s' % os.path.dirname(15 bus_address.startswith('unix:abstract=%s' % os.path.dirname(
15 os.getcwd())))16 os.getcwd())))
17
18 def test_config_file_path(self):
19 """Test that we loaded the config file from the local tree."""
20 expected = os.path.abspath(os.path.join(
21 os.path.dirname(__file__),
22 os.path.pardir, os.path.pardir, os.path.pardir, os.path.pardir,
23 'data', 'dbus-session.conf'))
24 runner = DBusRunner()
25 # pylint: disable=W0212
26 self.assertEqual(expected, runner._find_config_file())

Subscribers

People subscribed via source and target branches

to all changes: