Merge lp:~mikemc/ubuntuone-client/refactor-platform-event-logging into lp:ubuntuone-client

Proposed by Mike McCracken
Status: Merged
Approved by: dobey
Approved revision: 1239
Merged at revision: 1241
Proposed branch: lp:~mikemc/ubuntuone-client/refactor-platform-event-logging
Merge into: lp:ubuntuone-client
Prerequisite: lp:~mikemc/ubuntuone-client/test-platform-init-typo-bugfix
Diff against target: 159 lines (+36/-50)
7 files modified
tests/platform/event_logging/__init__.py (+27/-0)
tests/platform/event_logging/test_linux.py (+2/-2)
tests/platform/event_logging/test_windows.py (+1/-1)
ubuntuone/platform/event_logging/__init__.py (+5/-8)
ubuntuone/platform/event_logging/linux.py (+0/-1)
ubuntuone/platform/windows/__init__.py (+1/-2)
ubuntuone/platform/windows/event_logging.py (+0/-36)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-client/refactor-platform-event-logging
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Mike McCracken (community) Abstain
Brian Curtin (community) Approve
dobey (community) Approve
Review via email: mp+104301@code.launchpad.net

Commit message

- Refactor ubuntuone platform/event_logging into submodule ( LP: 989120 )

Description of the change

- Refactor ubuntuone platform/event_logging into submodule ( LP: 989120 )

* creates event_logging package in platform/

- Note: it's small to be a package, but this avoids importing 'is_zeitgeist_installed' on win/darwin

* moves platform/event_logging.py to be the __init__ of that package
* moves code in platform/linux/event_logging to new package

* removes platform/windows/event_logging, replaced with one line in new package __init__

Tested on linux.

To post a comment you must log in.
1236. By Mike McCracken

merge with trunk

1237. By Mike McCracken

refactor the test suite into event_logging/test_<theplatform>.py

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Brian Curtin (brian.curtin) wrote :

Tests aren't passing on Windows:

Traceback (most recent call last):
  File "C:\u1\bin\python-script.py", line 62, in <module>
    execfile(__file__)
  File "C:\u1\bin\u1trial", line 331, in <module>
    main()
  File "C:\u1\bin\u1trial", line 311, in main
    suite = trial_runner.get_suite(config)
  File "C:\u1\bin\u1trial", line 184, in get_suite
    config['ignore-paths']))
  File "C:\u1\bin\u1trial", line 168, in _collect_tests
    module_suite = self._load_unittest(filepath)
  File "C:\u1\bin\u1trial", line 108, in _load_unittest
    module = __import__(modpath, None, None, [""])
  File "C:\u1\working\mmcc\tests\platform\__init__.py", line 34, in <module>
    from tests.platform.ipc import test_windows
  File "C:\u1\working\mmcc\tests\platform\ipc\test_windows.py", line 44, in <module>
    from contrib.testing.testcase import (
  File "C:\u1\working\mmcc\contrib\testing\testcase.py", line 49, in <module>
    from ubuntuone.syncdaemon import (
  File "C:\u1\working\mmcc\ubuntuone\syncdaemon\config.py", line 47, in <module>
    from ubuntuone.platform import expand_user
  File "C:\u1\working\mmcc\ubuntuone\platform\__init__.py", line 40, in <module>
    from ubuntuone.platform import windows
  File "C:\u1\working\mmcc\ubuntuone\platform\windows\__init__.py", line 74, in <m
odule>
    from ubuntuone.platform.windows import event_logging
ImportError: cannot import name event_logging

Revision history for this message
Brian Curtin (brian.curtin) :
review: Needs Fixing
1238. By Mike McCracken

remove obsolete import in platform/windows/__init__.py

Revision history for this message
Mike McCracken (mikemc) wrote :

The last push fixes the error and passes the tests on linux and windows

review: Needs Resubmitting
Revision history for this message
Brian Curtin (brian.curtin) wrote :

Looks good and works on Windows.

review: Approve
Revision history for this message
Mike McCracken (mikemc) :
review: Abstain
Revision history for this message
Manuel de la Peña (mandel) wrote :

There seems to be conflicts with trunk.

review: Needs Fixing
1239. By Mike McCracken

merge with trunk

Revision history for this message
Mike McCracken (mikemc) wrote :

After latest merge fixed conflicts, tests pass in Linux and Windows

Revision history for this message
Manuel de la Peña (mandel) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'tests/platform/event_logging'
2=== added file 'tests/platform/event_logging/__init__.py'
3--- tests/platform/event_logging/__init__.py 1970-01-01 00:00:00 +0000
4+++ tests/platform/event_logging/__init__.py 2012-05-04 16:22:18 +0000
5@@ -0,0 +1,27 @@
6+# Copyright 2012 Canonical Ltd.
7+#
8+# This program is free software: you can redistribute it and/or modify it
9+# under the terms of the GNU General Public License version 3, as published
10+# by the Free Software Foundation.
11+#
12+# This program is distributed in the hope that it will be useful, but
13+# WITHOUT ANY WARRANTY; without even the implied warranties of
14+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15+# PURPOSE. See the GNU General Public License for more details.
16+#
17+# You should have received a copy of the GNU General Public License along
18+# with this program. If not, see <http://www.gnu.org/licenses/>.
19+#
20+# In addition, as a special exception, the copyright holders give
21+# permission to link the code of portions of this program with the
22+# OpenSSL library under certain conditions as described in each
23+# individual source file, and distribute linked combinations
24+# including the two.
25+# You must obey the GNU General Public License in all respects
26+# for all of the code used other than OpenSSL. If you modify
27+# file(s) with this exception, you may extend this exception to your
28+# version of the file(s), but you are not obligated to do so. If you
29+# do not wish to do so, delete this exception statement from your
30+# version. If you delete this exception statement from all source
31+# files in the program, then also delete it here.
32+"""Platform/event_logging test code."""
33
34=== renamed file 'tests/platform/linux/test_event_logging.py' => 'tests/platform/event_logging/test_linux.py'
35--- tests/platform/linux/test_event_logging.py 2012-04-09 20:07:05 +0000
36+++ tests/platform/event_logging/test_linux.py 2012-05-04 16:22:18 +0000
37@@ -1,4 +1,4 @@
38-# tests.platform.linux.test_event_logging
39+# tests.platform.event_logging.test_linux
40 #
41 # Author: Alejandro J. Cura <alecu@canonical.com>
42 #
43@@ -34,7 +34,7 @@
44
45 from twisted.trial.unittest import TestCase
46
47-from ubuntuone.platform.linux import event_logging
48+import ubuntuone.platform.event_logging.linux as event_logging
49
50
51 class ZeitgeistDetectionTestCase(TestCase):
52
53=== renamed file 'tests/platform/windows/test_event_logging.py' => 'tests/platform/event_logging/test_windows.py'
54--- tests/platform/windows/test_event_logging.py 2012-04-09 20:07:05 +0000
55+++ tests/platform/event_logging/test_windows.py 2012-05-04 16:22:18 +0000
56@@ -37,7 +37,7 @@
57
58 def test_never_creates_a_listener(self):
59 """The listener is never created on windows."""
60- from ubuntuone.platform.windows import event_logging
61+ from ubuntuone.platform import event_logging
62 listener = event_logging.get_listener(None, None)
63 self.assertEqual(listener, None)
64
65
66=== added directory 'ubuntuone/platform/event_logging'
67=== renamed file 'ubuntuone/platform/event_logging.py' => 'ubuntuone/platform/event_logging/__init__.py'
68--- ubuntuone/platform/event_logging.py 2012-04-09 20:07:05 +0000
69+++ ubuntuone/platform/event_logging/__init__.py 2012-05-04 16:22:18 +0000
70@@ -30,13 +30,10 @@
71
72 import sys
73
74-
75-if sys.platform == "win32":
76- from ubuntuone.platform.windows import event_logging
77- source = event_logging
78+if sys.platform in ["win32", "darwin"]:
79+ # Zeitgeist is not installed on these platforms
80+ get_listener = lambda x, y: None
81 else:
82- from ubuntuone.platform.linux import event_logging
83- source = event_logging
84- is_zeitgeist_installed = source.is_zeitgeist_installed
85+ from ubuntuone.platform.event_logging import linux as source
86+ get_listener = source.get_listener
87
88-get_listener = source.get_listener
89
90=== renamed file 'ubuntuone/platform/linux/event_logging.py' => 'ubuntuone/platform/event_logging/linux.py'
91--- ubuntuone/platform/linux/event_logging.py 2012-04-09 20:07:05 +0000
92+++ ubuntuone/platform/event_logging/linux.py 2012-05-04 16:22:18 +0000
93@@ -1,4 +1,3 @@
94-# ubuntuone.platform.linux.event_logging
95 #
96 # Author: Alejandro J. Cura <alecu@canonical.com>
97 #
98
99=== modified file 'ubuntuone/platform/windows/__init__.py'
100--- ubuntuone/platform/windows/__init__.py 2012-05-03 20:14:42 +0000
101+++ ubuntuone/platform/windows/__init__.py 2012-05-04 16:22:18 +0000
102@@ -36,7 +36,6 @@
103 platform = "win32"
104
105
106-import event_logging
107 import logger
108
109 from ubuntuone.platform.os_helper import (
110@@ -70,7 +69,7 @@
111 stat_path,
112 walk,
113 )
114-from ubuntuone.platform.windows import event_logging
115+
116 from ubuntuone.platform.windows.logger import (
117 setup_filesystem_logging,
118 get_filesystem_logger,
119
120=== removed file 'ubuntuone/platform/windows/event_logging.py'
121--- ubuntuone/platform/windows/event_logging.py 2012-04-09 20:07:05 +0000
122+++ ubuntuone/platform/windows/event_logging.py 1970-01-01 00:00:00 +0000
123@@ -1,36 +0,0 @@
124-# ubuntuone.platform.windows.event_logging
125-#
126-# Author: Alejandro J. Cura <alecu@canonical.com>
127-#
128-# Copyright 2010-2012 Canonical Ltd.
129-#
130-# This program is free software: you can redistribute it and/or modify it
131-# under the terms of the GNU General Public License version 3, as published
132-# by the Free Software Foundation.
133-#
134-# This program is distributed in the hope that it will be useful, but
135-# WITHOUT ANY WARRANTY; without even the implied warranties of
136-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
137-# PURPOSE. See the GNU General Public License for more details.
138-#
139-# You should have received a copy of the GNU General Public License along
140-# with this program. If not, see <http://www.gnu.org/licenses/>.
141-#
142-# In addition, as a special exception, the copyright holders give
143-# permission to link the code of portions of this program with the
144-# OpenSSL library under certain conditions as described in each
145-# individual source file, and distribute linked combinations
146-# including the two.
147-# You must obey the GNU General Public License in all respects
148-# for all of the code used other than OpenSSL. If you modify
149-# file(s) with this exception, you may extend this exception to your
150-# version of the file(s), but you are not obligated to do so. If you
151-# do not wish to do so, delete this exception statement from your
152-# version. If you delete this exception statement from all source
153-# files in the program, then also delete it here.
154-"""Event logging module for windows, that does nothing."""
155-
156-
157-def get_listener(fsm, vm):
158- """Zeitgeist is not available on windows yet."""
159- return None

Subscribers

People subscribed via source and target branches