Merge lp:~eeejay/mago/get_test_dir into lp:~mago-contributors/mago/mago-1.0

Proposed by Eitan Isaacson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~eeejay/mago/get_test_dir
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: None lines
To merge this branch: bzr merge lp:~eeejay/mago/get_test_dir
Reviewer Review Type Date Requested Status
Ara Pulido Needs Information
Nagappan Alagappan Approve
Review via email: mp+9154@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eitan Isaacson (eeejay) wrote :

I came to this modification because I needed to run the notify-osd test outside of the Mago directory. I think it would be useful for all tests that have data they need to refer to.

Revision history for this message
Nagappan Alagappan (nagappan) :
review: Approve
Revision history for this message
Ara Pulido (ara) wrote :

Hello Eitan,

The change looks good to me, but it would be great if you could update the documentation at http://mago.ubuntu.com/ to match the new requirements.

I would like the documentation to be as updated as possible.

Thanks,
Ara.

review: Needs Information
Revision history for this message
Javier Collado (javier.collado) wrote :

Hello,

The change looks great since it's indeed better to get the path from the the test suite file itself than from the current working directory.

Looking into the code even before the change, I've seen the usage of '|' as a separator to specify multiple oracle files. Wouldn't it be better to specify multiple <oracle> tags for that purpose?

Best regards,
    Javier

> I came to this modification because I needed to run the notify-osd test
> outside of the Mago directory. I think it would be useful for all tests that
> have data they need to refer to.

Revision history for this message
Eitan Isaacson (eeejay) wrote :

> Looking into the code even before the change, I've seen the usage of '|' as a
> separator to specify multiple oracle files. Wouldn't it be better to specify
> multiple <oracle> tags for that purpose?

Yeah, that is probably not pretty. It is a separate issue, though. Just an arbitrary separator I defined. Multiple 'oracle' tags are not possible because the tag names align to key word args, and you can't have two identical key word args.

It is a separate problem, unrelated to this branch. The proper behavior would probably be appending all identical tag's children to a list, and pass that list with the common tag name.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gedit/gedit_chains.py'
--- gedit/gedit_chains.py 2009-06-24 16:45:51 +0000
+++ gedit/gedit_chains.py 2009-07-22 19:11:47 +0000
@@ -15,8 +15,7 @@
1515
16 # oracle file path is assumed to be relative16 # oracle file path is assumed to be relative
17 # to test case code17 # to test case code
18 oracle = os.path.join(os.path.dirname(__file__),18 oracle = os.path.join(self.get_test_dir(), oracle)
19 oracle)
2019
21 testcheck = FileComparison(oracle, test_file)20 testcheck = FileComparison(oracle, test_file)
2221
2322
=== modified file 'mago/test_suite/main.py'
--- mago/test_suite/main.py 2009-06-23 13:26:34 +0000
+++ mago/test_suite/main.py 2009-07-22 18:58:59 +0000
@@ -3,6 +3,8 @@
3must be used by all test suites written for the mago package3must be used by all test suites written for the mago package
4"""4"""
5from ..application.main import Application5from ..application.main import Application
6from inspect import getsourcefile
7from os.path import dirname
68
7class TestSuite:9class TestSuite:
8 """10 """
@@ -18,6 +20,10 @@
18 def cleanup(self):20 def cleanup(self):
19 pass21 pass
2022
23 def get_test_dir(cls):
24 return dirname(getsourcefile(cls))
25 get_test_dir = classmethod(get_test_dir)
26
2127
22class SingleApplicationTestSuite(TestSuite):28class SingleApplicationTestSuite(TestSuite):
23 """29 """
2430
=== modified file 'notify-osd/notify_osd.py'
--- notify-osd/notify_osd.py 2009-06-23 13:26:34 +0000
+++ notify-osd/notify_osd.py 2009-07-22 19:08:16 +0000
@@ -4,12 +4,14 @@
4import ldtputils4import ldtputils
55
6from time import time, gmtime, strftime, sleep6from time import time, gmtime, strftime, sleep
7from os.path import join as path_join
78
8from mago.test_suite.deskex import NotifyOSDTestSuite9from mago.test_suite.deskex import NotifyOSDTestSuite
9from mago.check import ScreenshotCompare, FAIL10from mago.check import ScreenshotCompare, FAIL
1011
11class NotifyOSDTest(NotifyOSDTestSuite):12class NotifyOSDTest(NotifyOSDTestSuite):
12 def layoutTest(self, oracle=None, summary=None, body=None, icon=None):13 def layoutTest(self, oracle=None, summary=None, body=None, icon=None):
14 oracle = path_join(self.get_test_dir(), oracle)
13 self.application.notify(summary, body, icon)15 self.application.notify(summary, body, icon)
14 elapsed, screeny = self.application.grab_image_and_wait(summary)16 elapsed, screeny = self.application.grab_image_and_wait(summary)
1517
@@ -25,7 +27,8 @@
25 raise AssertionError('screenshots differ', screeny)27 raise AssertionError('screenshots differ', screeny)
2628
27 def queueTest(self, oracle=None, summary=None, body=None, icon=None):29 def queueTest(self, oracle=None, summary=None, body=None, icon=None):
28 oracles = oracle.split('|')30 oracles = [path_join(self.get_test_dir(), o) \
31 for o in oracle.split('|')]
29 summaries = summary.split('|')32 summaries = summary.split('|')
30 bodies = body.split('|')33 bodies = body.split('|')
31 icons = icon.split('|')34 icons = icon.split('|')
3235
=== modified file 'notify-osd/notify_osd.xml'
--- notify-osd/notify_osd.xml 2009-03-22 23:36:18 +0000
+++ notify-osd/notify_osd.xml 2009-07-22 19:08:16 +0000
@@ -8,7 +8,7 @@
8 Test the layout of a bubble with an icon, summary and body8 Test the layout of a bubble with an icon, summary and body
9 </description>9 </description>
10 <args>10 <args>
11 <oracle>./notify-osd/data/icons_summary_body.png</oracle>11 <oracle>data/icons_summary_body.png</oracle>
12 <summary>Nat King Cole</summary>12 <summary>Nat King Cole</summary>
13 <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?</body>13 <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?</body>
14 <icon>notification-message-IM</icon>14 <icon>notification-message-IM</icon>
@@ -20,7 +20,7 @@
20 Test the layout of a bubble with an icon and summary.20 Test the layout of a bubble with an icon and summary.
21 </description>21 </description>
22 <args>22 <args>
23 <oracle>./notify-osd/data/icons_summary.png</oracle>23 <oracle>data/icons_summary.png</oracle>
24 <summary>WiFi connection lost</summary>24 <summary>WiFi connection lost</summary>
25 <body></body>25 <body></body>
26 <icon>notification-network-wireless-disconnected</icon>26 <icon>notification-network-wireless-disconnected</icon>
@@ -32,7 +32,7 @@
32 Test the layout of a bubble with a summary only.32 Test the layout of a bubble with a summary only.
33 </description>33 </description>
34 <args>34 <args>
35 <oracle>./notify-osd/data/summary_body.png</oracle>35 <oracle>data/summary_body.png</oracle>
36 <summary>Totem</summary>36 <summary>Totem</summary>
37 <body>This is a superfluous notification</body>37 <body>This is a superfluous notification</body>
38 <icon></icon>38 <icon></icon>
@@ -44,7 +44,7 @@
44 Test the layout of a bubble with a summary only.44 Test the layout of a bubble with a summary only.
45 </description>45 </description>
46 <args>46 <args>
47 <oracle>./notify-osd/data/summary.png</oracle>47 <oracle>data/summary.png</oracle>
48 <summary>Summary-only</summary>48 <summary>Summary-only</summary>
49 <body></body>49 <body></body>
50 <icon></icon>50 <icon></icon>
@@ -56,7 +56,7 @@
56 Test the bubble queue.56 Test the bubble queue.
57 </description>57 </description>
58 <args>58 <args>
59 <oracle>./notify-osd/data/icons_summary_body.png|./notify-osd/data/icons_summary.png|./notify-osd/data/summary.png</oracle>59 <oracle>data/icons_summary_body.png|data/icons_summary.png|data/summary.png</oracle>
60 <summary>Nat King Cole|WiFi connection lost|Summary-only</summary>60 <summary>Nat King Cole|WiFi connection lost|Summary-only</summary>
61 <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?||</body>61 <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?||</body>
62 <icon>notification-message-IM|notification-network-wireless-disconnected|</icon>62 <icon>notification-message-IM|notification-network-wireless-disconnected|</icon>

Subscribers

People subscribed via source and target branches

to status/vote changes: