Merge lp:~nskaggs/autopilot/fix-1328600 into lp:autopilot
- fix-1328600
- Merge into trunk
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~nskaggs/autopilot/fix-1328600 | ||||
Merge into: | lp:autopilot | ||||
Diff against target: |
507 lines (+183/-87) 8 files modified
autopilot/introspection/types.py (+14/-3) autopilot/tests/functional/test_types.py (+8/-2) autopilot/tests/unit/test_types.py (+122/-47) debian/control (+35/-30) debian/copyright (+0/-1) debian/python3-autopilot-tests.install (+2/-2) debian/python3-autopilot-vis.install (+1/-1) debian/python3-autopilot.install (+1/-1) |
||||
To merge this branch: | bzr merge lp:~nskaggs/autopilot/fix-1328600 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Robert Bruce Park (community) | Approve | ||
Christopher Lee (community) | Needs Fixing | ||
Thomi Richards (community) | Approve | ||
Barry Warsaw | Pending | ||
Review via email: mp+227399@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-10-02.
Commit message
Workaround around 32-bit platform limitations with regards to timestamps. Bug 1328600
Also also changed the static values to be defined variables. This is different than the other tests, so feel free to nitpick at it and I'll revert back to the static values.
Note in this case, I'm not sure a scenario for the large value would work well, thus it's left as a single testcase.
Description of the change
Fixes bug 1328600. Includes a test for "large" timestamps as well
This works around 32-bit platform limitations.
PS Jenkins bot (ps-jenkins) wrote : | # |
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
This doesn't actually fix the problem, it just creates new problems. Please see my comment on the bug report:
https:/
Thanks for the patch though, but it looks like this is going to be a bit more of an involved fix.
Cheers,
Nicholas Skaggs (nskaggs) wrote : | # |
So the idea of using tzlocal seems to suffer from daylight savings problem, unless I'm missing something.
>>> from datetime import datetime, time, timedelta
>>> from dateutil.tz import tzlocal, tzutc
>>> print(datetime.
2013-08-22 18:18:47
>>> print(datetime.
2013-08-22 22:18:47+00:00
>>> naive = datetime.
>>> print(naive)
2013-08-22 17:18:47
>>> aware = naive.replace(
>>> print(aware)
2013-08-22 17:18:47-04:00
>>> print(aware.
2013-08-22 21:18:47+00:00
>>> aware2 = datetime.
>>> print(aware2)
1969-12-31 19:00:00-05:00
>>> print(aware2.
1970-01-01 00:00:00+00:00
>>> try2 = aware2 + timedelta(
>>> print(try2)
2013-08-22 17:18:47-04:00
>>> print(try2.
2013-08-22 21:18:47+00:00
Nicholas Skaggs (nskaggs) wrote : | # |
Going to grab the local offset at the time of the timestamp and apply it against the fromtimestamp date.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:511
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:512
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:513
http://
Executed test runs:
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:512
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
I have a couple of comments in the diff.
Overall, this looks excellent - thank you for taking this on.
There's one change I'd like you to make in the tests, and I'd really like Barry Warsaw to review the implementation.
I'm setting this to approve, so you don't need a re-review once those two things have happeend (I trust ya :D )
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
Oh, also, CI has to pass (obviously)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:514
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:513
http://
Executed test runs:
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:513
http://
Executed test runs:
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:514
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
Tests don't want to run now?
/var/local/
/var/local/
tail: '/var/lib/
/var/local/
/var/local/
/var/local/
/var/local/
/var/local/
/var/local/
/var/local/
/var/local/
/var/local/
tail: /var/lib/
/var/local/
/var/local/
/var/local/
/var/local/
/var/local/
/var/local/
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:514
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:509
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:515
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:509
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:516
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:522
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:523
http://
Executed test runs:
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:524
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:525
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:529
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:529
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:529
http://
Executed test runs:
None: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
None: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 530. By Nicholas Skaggs
-
merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:530
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
Why is this running 0 tests?
- 531. By Nicholas Skaggs
-
swap TestWithScenarios around
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:531
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 532. By Nicholas Skaggs
-
undo swap
Nicholas Skaggs (nskaggs) wrote : | # |
I see a crash:
PythonArgs: ['/usr/
Traceback:
Traceback (most recent call last):
File "/usr/sbin/
commands[
File "/usr/sbin/
if get_profiles() == {}:
File "/usr/sbin/
for p in open(apparmor_
PermissionError: [Errno 13] Permission denied: '/sys/kernel/
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:532
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:532
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 533. By Nicholas Skaggs
-
add depends to tests as well
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:533
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:533
http://
Executed test runs:
None: http://
None: http://
None: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
Traceback (most recent call last):
File "/usr/lib/
datetime(2014, 1, 1, 0, 0, 0)
File "/usr/lib/
self.
File "/usr/lib/
raise mismatch_error
testtools.
- 534. By Nicholas Skaggs
-
tweak functional test
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:534
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 535. By Nicholas Skaggs
-
add tzlocal to datetime functional test
- 536. By Nicholas Skaggs
-
wrap and sort packaging tweaks
Christopher Lee (veebers) wrote : | # |
A couple of minor indent issues. Deeper review to come.
Robert Bruce Park (robru) wrote : | # |
Packaging looks good, thanks for the wrap-and-sort, makes for a noisy diff now but easier to read later.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:535
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 537. By Nicholas Skaggs
-
fix layout, properly construct object for functional test
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:536
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:537
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
Can you provide an update on what you'd like to see with mp?
Unmerged revisions
Preview Diff
1 | === modified file 'autopilot/introspection/types.py' |
2 | --- autopilot/introspection/types.py 2014-05-29 19:44:44 +0000 |
3 | +++ autopilot/introspection/types.py 2014-09-08 23:54:02 +0000 |
4 | @@ -37,7 +37,8 @@ |
5 | |
6 | """ |
7 | |
8 | -from datetime import datetime, time |
9 | +from datetime import datetime, time, timedelta |
10 | +from dateutil.tz import tzlocal |
11 | import dbus |
12 | import logging |
13 | from testtools.matchers import Equals |
14 | @@ -547,6 +548,8 @@ |
15 | """The DateTime class represents a date and time in the UTC timezone. |
16 | |
17 | DateTime is constructed by passing a unix timestamp in to the constructor. |
18 | + The incoming timestamp is assumed to be in localtime. |
19 | + For date support for 32-bit platforms beyond 2038, we use a timedelta. |
20 | Timestamps are expressed as the number of seconds since 1970-01-01T00:00:00 |
21 | in the UTC timezone:: |
22 | |
23 | @@ -573,6 +576,9 @@ |
24 | 18 |
25 | >>> my_dt.second |
26 | 47 |
27 | + >>> my_dt.tzinfo |
28 | + UTC |
29 | + |
30 | |
31 | Two DateTime objects can be compared for equality:: |
32 | |
33 | @@ -599,7 +605,8 @@ |
34 | """ |
35 | def __init__(self, *args, **kwargs): |
36 | super(DateTime, self).__init__(*args, **kwargs) |
37 | - self._cached_dt = datetime.fromtimestamp(self[0]) |
38 | + self._cached_dt = datetime.fromtimestamp( |
39 | + 0, tz=tzlocal()) + timedelta(seconds=self[0]) |
40 | |
41 | @property |
42 | def year(self): |
43 | @@ -627,7 +634,11 @@ |
44 | |
45 | @property |
46 | def timestamp(self): |
47 | - return self[0] |
48 | + return self._cached_dt.timestamp |
49 | + |
50 | + @property |
51 | + def tzinfo(self): |
52 | + return self._cached_dt.tzinfo |
53 | |
54 | @property |
55 | def datetime(self): |
56 | |
57 | === modified file 'autopilot/tests/functional/test_types.py' |
58 | --- autopilot/tests/functional/test_types.py 2014-05-22 06:41:16 +0000 |
59 | +++ autopilot/tests/functional/test_types.py 2014-09-08 23:54:02 +0000 |
60 | @@ -1,8 +1,10 @@ |
61 | |
62 | -from datetime import datetime |
63 | +from datetime import datetime, timedelta |
64 | +import time |
65 | |
66 | from autopilot.testcase import AutopilotTestCase |
67 | from autopilot.tests.functional import QmlScriptRunnerMixin |
68 | +from dateutil.tz import tzlocal |
69 | |
70 | from textwrap import dedent |
71 | |
72 | @@ -23,7 +25,11 @@ |
73 | ) |
74 | ) |
75 | item = proxy.select_single('*', objectName="TestMePlease") |
76 | + dt = datetime(2014, 1, 1, 0, 0, 0, tzinfo=tzlocal()) |
77 | + timestamp = time.mktime(dt.timetuple()) |
78 | + dt = datetime.fromtimestamp( |
79 | + 0, tz=tzlocal()) + timedelta(seconds=timestamp) |
80 | self.assertEqual( |
81 | item.foo, |
82 | - datetime(2014, 1, 1, 0, 0, 0) |
83 | + dt |
84 | ) |
85 | |
86 | === modified file 'autopilot/tests/unit/test_types.py' |
87 | --- autopilot/tests/unit/test_types.py 2014-07-22 02:39:26 +0000 |
88 | +++ autopilot/tests/unit/test_types.py 2014-09-08 23:54:02 +0000 |
89 | @@ -17,8 +17,9 @@ |
90 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
91 | # |
92 | |
93 | -from datetime import datetime, time |
94 | -from testscenarios import TestWithScenarios |
95 | +from datetime import datetime, time, timedelta |
96 | +import pytz |
97 | +from testscenarios import TestWithScenarios, multiply_scenarios |
98 | from testtools import TestCase |
99 | from testtools.matchers import Equals, IsInstance, NotEquals, raises |
100 | |
101 | @@ -281,79 +282,153 @@ |
102 | self.assertEqual(repr(c), str(c)) |
103 | |
104 | |
105 | -class DateTimeTests(TestCase): |
106 | +class DateTimeTests(TestWithScenarios, TestCase): |
107 | + |
108 | + timestamps = [ |
109 | + ('32bitlimit', |
110 | + {'timestamp': 2983579200 |
111 | + }), |
112 | + |
113 | + ('winter', |
114 | + {'timestamp': 1389744000 |
115 | + }), |
116 | + |
117 | + ('summer', |
118 | + {'timestamp': 1405382400 |
119 | + }) |
120 | + ] |
121 | + |
122 | + timezones = [ |
123 | + ('UTC', |
124 | + {'timezone': 'UTC' |
125 | + }), |
126 | + |
127 | + ('NewZealand', |
128 | + {'timezone': 'NZ', |
129 | + }), |
130 | + |
131 | + ('Pacific', |
132 | + {'timezone': 'US/Pacific' |
133 | + }), |
134 | + |
135 | + ('Hongkong', |
136 | + {'timezone': 'Hongkong' |
137 | + }), |
138 | + |
139 | + ('MSK', |
140 | + {'timezone': 'Europe/Moscow' |
141 | + }) |
142 | + ] |
143 | + |
144 | + scenarios = multiply_scenarios(timestamps, timezones) |
145 | + |
146 | + def local_timezone(self): |
147 | + tz = pytz.timezone(self.timezone) |
148 | + return tz |
149 | + |
150 | + def local_from_timestamp(self, timestamp): |
151 | + # fromtimestamp is naive |
152 | + # thus we need create a "local" timestamp for test comparision |
153 | + # and support 32-bit limit via timedelta |
154 | + return datetime.fromtimestamp( |
155 | + 0, tz=self.local_timezone()) + timedelta(seconds=timestamp) |
156 | |
157 | def test_can_construct_datetime(self): |
158 | - dt = DateTime(1377209927) |
159 | - self.assertThat(dt, IsInstance(dbus.Array)) |
160 | + with patch('autopilot.introspection.types.tzlocal', |
161 | + new=self.local_timezone): |
162 | + dt = DateTime(self.timestamp) |
163 | + self.assertThat(dt, IsInstance(dbus.Array)) |
164 | |
165 | def test_datetime_has_slice_access(self): |
166 | - dt = DateTime(1377209927) |
167 | + with patch('autopilot.introspection.types.tzlocal', |
168 | + new=self.local_timezone): |
169 | + dt = DateTime(self.timestamp) |
170 | |
171 | - self.assertThat(dt[0], Equals(1377209927)) |
172 | + self.assertThat(dt[0], Equals(self.timestamp)) |
173 | |
174 | def test_datetime_has_properties(self): |
175 | - dt = DateTime(1377209927) |
176 | + with patch('autopilot.introspection.types.tzlocal', |
177 | + new=self.local_timezone): |
178 | + dt = DateTime(self.timestamp) |
179 | |
180 | - self.assertTrue(hasattr(dt, 'timestamp')) |
181 | - self.assertTrue(hasattr(dt, 'year')) |
182 | - self.assertTrue(hasattr(dt, 'month')) |
183 | - self.assertTrue(hasattr(dt, 'day')) |
184 | - self.assertTrue(hasattr(dt, 'hour')) |
185 | - self.assertTrue(hasattr(dt, 'minute')) |
186 | - self.assertTrue(hasattr(dt, 'second')) |
187 | + self.assertTrue(hasattr(dt, 'timestamp')) |
188 | + self.assertTrue(hasattr(dt, 'year')) |
189 | + self.assertTrue(hasattr(dt, 'month')) |
190 | + self.assertTrue(hasattr(dt, 'day')) |
191 | + self.assertTrue(hasattr(dt, 'hour')) |
192 | + self.assertTrue(hasattr(dt, 'minute')) |
193 | + self.assertTrue(hasattr(dt, 'second')) |
194 | + self.assertTrue(hasattr(dt, 'tzinfo')) |
195 | |
196 | def test_datetime_properties_have_correct_values(self): |
197 | - dt = DateTime(1377209927) |
198 | - dt_with_tz = datetime.fromtimestamp(1377209927) |
199 | + with patch('autopilot.introspection.types.tzlocal', |
200 | + new=self.local_timezone): |
201 | + dt1 = DateTime(self.timestamp) |
202 | + dt2 = self.local_from_timestamp(self.timestamp) |
203 | |
204 | - self.assertThat(dt.timestamp, Equals(dt_with_tz.timestamp())) |
205 | - self.assertThat(dt.year, Equals(dt_with_tz.year)) |
206 | - self.assertThat(dt.month, Equals(dt_with_tz.month)) |
207 | - self.assertThat(dt.day, Equals(dt_with_tz.day)) |
208 | - self.assertThat(dt.hour, Equals(dt_with_tz.hour)) |
209 | - self.assertThat(dt.minute, Equals(dt_with_tz.minute)) |
210 | - self.assertThat(dt.second, Equals(dt_with_tz.second)) |
211 | + self.assertThat(dt1.year, Equals(dt2.year)) |
212 | + self.assertThat(dt1.month, Equals(dt2.month)) |
213 | + self.assertThat(dt1.day, Equals(dt2.day)) |
214 | + self.assertThat(dt1.hour, Equals(dt2.hour)) |
215 | + self.assertThat(dt1.minute, Equals(dt2.minute)) |
216 | + self.assertThat(dt1.second, Equals(dt2.second)) |
217 | + self.assertThat(dt1.tzinfo, Equals(dt2.tzinfo)) |
218 | + self.assertThat(dt1.timestamp(), Equals(dt2.timestamp())) |
219 | + self.assertThat(dt1.timestamp(), Equals(self.timestamp)) |
220 | |
221 | def test_equality_with_datetime(self): |
222 | - dt1 = DateTime(1377209927) |
223 | - dt2 = DateTime(1377209927) |
224 | + with patch('autopilot.introspection.types.tzlocal', |
225 | + new=self.local_timezone): |
226 | + dt1 = DateTime(self.timestamp) |
227 | + dt2 = datetime(dt1.year, dt1.month, dt1.day, |
228 | + dt1.hour, dt1.minute, dt1.second, |
229 | + tzinfo=dt1.tzinfo) |
230 | |
231 | - self.assertThat(dt1, Equals(dt2)) |
232 | + self.assertThat(dt1, Equals(dt2)) |
233 | |
234 | def test_equality_with_list(self): |
235 | - dt1 = DateTime(1377209927) |
236 | - dt2 = [1377209927] |
237 | + with patch('autopilot.introspection.types.tzlocal', |
238 | + new=self.local_timezone): |
239 | + dt1 = DateTime(self.timestamp) |
240 | + dt2 = [self.timestamp] |
241 | |
242 | - self.assertThat(dt1, Equals(dt2)) |
243 | + self.assertThat(dt1, Equals(dt2)) |
244 | |
245 | def test_equality_with_datetime_timestamp(self): |
246 | - # DateTime no longer assumes UTC and uses local TZ. |
247 | - dt1 = DateTime(1377209927) |
248 | - dt2 = datetime.fromtimestamp(1377209927) |
249 | - dt3 = datetime.fromtimestamp(1377209928) |
250 | + with patch('autopilot.introspection.types.tzlocal', |
251 | + new=self.local_timezone): |
252 | + dt1 = DateTime(self.timestamp) |
253 | + dt2 = self.local_from_timestamp(self.timestamp) |
254 | + dt3 = self.local_from_timestamp(self.timestamp + 1) |
255 | |
256 | - self.assertThat(dt1, Equals(dt2)) |
257 | - self.assertThat(dt1, NotEquals(dt3)) |
258 | + self.assertThat(dt1, Equals(dt2)) |
259 | + self.assertThat(dt1, NotEquals(dt3)) |
260 | |
261 | def test_can_convert_to_datetime(self): |
262 | - dt1 = DateTime(1377209927) |
263 | + with patch('autopilot.introspection.types.tzlocal', |
264 | + new=self.local_timezone): |
265 | + dt1 = DateTime(self.timestamp) |
266 | |
267 | - self.assertThat(dt1.datetime, IsInstance(datetime)) |
268 | + self.assertThat(dt1.datetime, IsInstance(datetime)) |
269 | |
270 | def test_repr(self): |
271 | - expected = repr_type( |
272 | - u"DateTime({:%Y-%m-%d %H:%M:%S})".format( |
273 | - datetime.fromtimestamp(1377209927) |
274 | + with patch('autopilot.introspection.types.tzlocal', |
275 | + new=self.local_timezone): |
276 | + dt = DateTime(self.timestamp) |
277 | + observed = repr(dt) |
278 | + expected = repr_type( |
279 | + u"DateTime({:%Y-%m-%d %H:%M:%S})".format( |
280 | + self.local_from_timestamp( |
281 | + self.timestamp).replace(tzinfo=self.local_timezone()) |
282 | + ) |
283 | ) |
284 | - ) |
285 | - dt = DateTime(1377209927) |
286 | - observed = repr(dt) |
287 | - self.assertEqual(expected, observed) |
288 | + self.assertEqual(expected, observed) |
289 | |
290 | def test_repr_equals_str(self): |
291 | - dt = DateTime(1377209927) |
292 | - self.assertEqual(repr(dt), str(dt)) |
293 | + with patch('autopilot.introspection.types.tzlocal', |
294 | + new=self.local_timezone): |
295 | + dt = DateTime(self.timestamp) |
296 | + self.assertEqual(repr(dt), str(dt)) |
297 | |
298 | |
299 | class TimeTests(TestCase): |
300 | |
301 | === modified file 'debian/control' |
302 | --- debian/control 2014-08-05 21:58:41 +0000 |
303 | +++ debian/control 2014-09-08 23:54:02 +0000 |
304 | @@ -15,6 +15,7 @@ |
305 | libjs-underscore, |
306 | liblttng-ust-dev, |
307 | python3-all-dev (>= 3.4), |
308 | + python3-dateutil, |
309 | python3-dbus, |
310 | python3-decorator, |
311 | python3-evdev, |
312 | @@ -22,13 +23,14 @@ |
313 | python3-flake8, |
314 | python3-gi, |
315 | python3-junitxml, |
316 | + python3-pil, |
317 | python3-psutil, |
318 | - python3-pil, |
319 | python3-setuptools, |
320 | python3-sphinx, |
321 | python3-subunit, |
322 | python3-testscenarios, |
323 | python3-testtools, |
324 | + python3-tz, |
325 | python3-xlib, |
326 | sphinx-common, |
327 | texlive-latex-extra, |
328 | @@ -40,33 +42,34 @@ |
329 | |
330 | Package: python3-autopilot |
331 | Architecture: all |
332 | -Depends: ${misc:Depends}, |
333 | - ${python3:Depends}, |
334 | - gir1.2-ubuntu-app-launch-2 | gir1.2-upstart-app-launch-2, |
335 | - libjs-underscore, libjs-jquery, |
336 | +Depends: gir1.2-ubuntu-app-launch-2 | gir1.2-upstart-app-launch-2, |
337 | + libjs-jquery, |
338 | + libjs-underscore, |
339 | python3-dbus, |
340 | python3-decorator, |
341 | python3-fixtures, |
342 | python3-gi, |
343 | python3-junitxml, |
344 | + python3-pil, |
345 | python3-psutil, |
346 | - python3-pil, |
347 | python3-subunit, |
348 | python3-testscenarios, |
349 | python3-testtools, |
350 | udev, |
351 | -Recommends: python3-xlib, |
352 | - python3-evdev, |
353 | - gir1.2-gconf-2.0, |
354 | + ${misc:Depends}, |
355 | + ${python3:Depends}, |
356 | +Recommends: gir1.2-gconf-2.0, |
357 | gir1.2-glib-2.0, |
358 | gir1.2-gtk-3.0, |
359 | gir1.2-ibus-1.0, |
360 | libautopilot-gtk (>= 1.4), |
361 | libautopilot-qt (>= 1.4), |
362 | python3-autopilot-trace, |
363 | + python3-evdev, |
364 | + python3-xlib, |
365 | recordmydesktop, |
366 | Breaks: libautopilot-gtk (<< 1.4), |
367 | - libautopilot-qt (<< 1.4), |
368 | + libautopilot-qt (<< 1.4), |
369 | Description: Utility to write and run integration tests easily (Python 3) |
370 | The autopilot engine enables to ease the writing of python tests |
371 | for your application manipulating your inputs like the mouse and |
372 | @@ -75,9 +78,9 @@ |
373 | |
374 | Package: python3-autopilot-trace |
375 | Architecture: any |
376 | -Depends: ${misc:Depends}, |
377 | +Depends: python3-autopilot, |
378 | + ${misc:Depends}, |
379 | ${shlibs:Depends}, |
380 | - python3-autopilot, |
381 | Description: Support for tracing in autopilot (Python 3) |
382 | This package contains the binary lttng trace point for tracing |
383 | autopilot tests. This is useful when using autopilot to exercise |
384 | @@ -86,12 +89,12 @@ |
385 | Package: autopilot-touch |
386 | Architecture: all |
387 | Section: metapackages |
388 | -Depends: ${misc:Depends}, |
389 | - autopilot-qt5, |
390 | +Depends: autopilot-qt5, |
391 | + fbset, |
392 | + python3-autopilot, |
393 | + python3-evdev, |
394 | qttestability-autopilot, |
395 | - python3-autopilot, |
396 | - python3-evdev, |
397 | - fbset, |
398 | + ${misc:Depends}, |
399 | Description: Autopilot support for the ubuntu Touch platform |
400 | This metapackage exists to depend on the packages needed to install and use |
401 | autopilot on the Ubuntu Touch platform. |
402 | @@ -99,14 +102,14 @@ |
403 | Package: autopilot-desktop |
404 | Architecture: all |
405 | Section: metapackages |
406 | -Depends: ${misc:Depends}, |
407 | - at-spi2-core, |
408 | +Depends: at-spi2-core, |
409 | + bamfdaemon, |
410 | gir1.2-gconf-2.0, |
411 | gir1.2-glib-2.0, |
412 | gir1.2-gtk-3.0, |
413 | python3-autopilot, |
414 | python3-xlib, |
415 | - bamfdaemon, |
416 | + ${misc:Depends}, |
417 | Recommends: python3-autopilot-vis, |
418 | python3-evdev, |
419 | Description: Autopilot support for the ubuntu Desktop platform |
420 | @@ -115,13 +118,13 @@ |
421 | |
422 | Package: python3-autopilot-vis |
423 | Architecture: all |
424 | -Depends: ${misc:Depends}, |
425 | - ${python3:Depends}, |
426 | - gnome-icon-theme, |
427 | +Depends: gnome-icon-theme, |
428 | python3-autopilot, |
429 | python3-dbus, |
430 | python3-dbus.mainloop.qt, |
431 | python3-pyqt4, |
432 | + ${misc:Depends}, |
433 | + ${python3:Depends}, |
434 | Recommends: python3-lxml, |
435 | Description: visualisation application for Autopilot (Python 3) |
436 | The Autopilot vis tool allows you to inspect an application introspection |
437 | @@ -130,17 +133,19 @@ |
438 | |
439 | Package: python3-autopilot-tests |
440 | Architecture: all |
441 | -Depends: ${misc:Depends}, |
442 | - ${python3:Depends}, |
443 | - libautopilot-gtk (>= 1.4), |
444 | +Depends: libautopilot-gtk (>= 1.4), |
445 | libautopilot-qt (>= 1.4), |
446 | - python3-autopilot, |
447 | - python3-dbus.mainloop.qt, |
448 | - python3-evdev, |
449 | - python3-pyqt4, |
450 | python-windowmocker, |
451 | + python3-autopilot, |
452 | + python3-dateutil, |
453 | + python3-dbus.mainloop.qt, |
454 | + python3-evdev, |
455 | + python3-pyqt4, |
456 | + python3-tz, |
457 | qmlscene, |
458 | recordmydesktop, |
459 | + ${misc:Depends}, |
460 | + ${python3:Depends}, |
461 | Description: Tests for the autopilot functional test tool. (Python 3) |
462 | This package contains tests for the python3-autopilot package. |
463 | You can use this package to verify that autopilot is functioning |
464 | |
465 | === modified file 'debian/copyright' |
466 | --- debian/copyright 2013-08-28 07:24:58 +0000 |
467 | +++ debian/copyright 2014-09-08 23:54:02 +0000 |
468 | @@ -21,4 +21,3 @@ |
469 | . |
470 | On Debian systems, the complete text of the GNU General |
471 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". |
472 | - |
473 | |
474 | === modified file 'debian/python3-autopilot-tests.install' |
475 | --- debian/python3-autopilot-tests.install 2014-04-02 01:30:40 +0000 |
476 | +++ debian/python3-autopilot-tests.install 2014-09-08 23:54:02 +0000 |
477 | @@ -1,4 +1,4 @@ |
478 | usr/lib/python3*/*/autopilot/tests/*.py |
479 | +usr/lib/python3*/*/autopilot/tests/acceptance/*.py |
480 | +usr/lib/python3*/*/autopilot/tests/functional/*.py |
481 | usr/lib/python3*/*/autopilot/tests/unit/*.py |
482 | -usr/lib/python3*/*/autopilot/tests/functional/*.py |
483 | -usr/lib/python3*/*/autopilot/tests/acceptance/*.py |
484 | |
485 | === modified file 'debian/python3-autopilot-vis.install' |
486 | --- debian/python3-autopilot-vis.install 2014-05-05 20:37:46 +0000 |
487 | +++ debian/python3-autopilot-vis.install 2014-09-08 23:54:02 +0000 |
488 | @@ -1,4 +1,4 @@ |
489 | -usr/lib/python3*/*/autopilot/vis/*.py |
490 | debian/autopilot3-vis.desktop /usr/share/applications |
491 | icons/autopilot-toggle-overlay.svg /usr/share/icons/hicolor/scalable/actions/ |
492 | icons/autopilot.svg /usr/share/icons/hicolor/scalable/apps/ |
493 | +usr/lib/python3*/*/autopilot/vis/*.py |
494 | |
495 | === modified file 'debian/python3-autopilot.install' |
496 | --- debian/python3-autopilot.install 2014-05-15 05:59:44 +0000 |
497 | +++ debian/python3-autopilot.install 2014-09-08 23:54:02 +0000 |
498 | @@ -1,3 +1,4 @@ |
499 | + |
500 | debian/61-autopilot3-uinput.rules /lib/udev/rules.d |
501 | usr/bin/autopilot3 /usr/bin/ |
502 | usr/bin/autopilot3-sandbox-run /usr/bin/ |
503 | @@ -9,4 +10,3 @@ |
504 | usr/lib/python3*/*/autopilot/introspection/*.py |
505 | usr/lib/python3*/*/autopilot/matchers/*.py |
506 | usr/lib/python3*/*/autopilot/process/*.py |
507 | - |
PASSED: Continuous integration, rev:506 jenkins. qa.ubuntu. com/job/ autopilot- ci/804/ jenkins. qa.ubuntu. com/job/ autopilot- utopic- amd64-ci/ 79 jenkins. qa.ubuntu. com/job/ autopilot- utopic- amd64-ci/ 79/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ autopilot- utopic- armhf-ci/ 78 jenkins. qa.ubuntu. com/job/ autopilot- utopic- armhf-ci/ 78/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ autopilot- utopic- i386-ci/ 78 jenkins. qa.ubuntu. com/job/ autopilot- utopic- i386-ci/ 78/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/2206 jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic- autopilot/ 219 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/2415 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/3380 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/3380/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 10094 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic- autopilot/ 283 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/2059 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/2059/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/autopilot- ci/804/ rebuild
http://