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
1=== modified file 'gedit/gedit_chains.py'
2--- gedit/gedit_chains.py 2009-06-24 16:45:51 +0000
3+++ gedit/gedit_chains.py 2009-07-22 19:11:47 +0000
4@@ -15,8 +15,7 @@
5
6 # oracle file path is assumed to be relative
7 # to test case code
8- oracle = os.path.join(os.path.dirname(__file__),
9- oracle)
10+ oracle = os.path.join(self.get_test_dir(), oracle)
11
12 testcheck = FileComparison(oracle, test_file)
13
14
15=== modified file 'mago/test_suite/main.py'
16--- mago/test_suite/main.py 2009-06-23 13:26:34 +0000
17+++ mago/test_suite/main.py 2009-07-22 18:58:59 +0000
18@@ -3,6 +3,8 @@
19 must be used by all test suites written for the mago package
20 """
21 from ..application.main import Application
22+from inspect import getsourcefile
23+from os.path import dirname
24
25 class TestSuite:
26 """
27@@ -18,6 +20,10 @@
28 def cleanup(self):
29 pass
30
31+ def get_test_dir(cls):
32+ return dirname(getsourcefile(cls))
33+ get_test_dir = classmethod(get_test_dir)
34+
35
36 class SingleApplicationTestSuite(TestSuite):
37 """
38
39=== modified file 'notify-osd/notify_osd.py'
40--- notify-osd/notify_osd.py 2009-06-23 13:26:34 +0000
41+++ notify-osd/notify_osd.py 2009-07-22 19:08:16 +0000
42@@ -4,12 +4,14 @@
43 import ldtputils
44
45 from time import time, gmtime, strftime, sleep
46+from os.path import join as path_join
47
48 from mago.test_suite.deskex import NotifyOSDTestSuite
49 from mago.check import ScreenshotCompare, FAIL
50
51 class NotifyOSDTest(NotifyOSDTestSuite):
52 def layoutTest(self, oracle=None, summary=None, body=None, icon=None):
53+ oracle = path_join(self.get_test_dir(), oracle)
54 self.application.notify(summary, body, icon)
55 elapsed, screeny = self.application.grab_image_and_wait(summary)
56
57@@ -25,7 +27,8 @@
58 raise AssertionError('screenshots differ', screeny)
59
60 def queueTest(self, oracle=None, summary=None, body=None, icon=None):
61- oracles = oracle.split('|')
62+ oracles = [path_join(self.get_test_dir(), o) \
63+ for o in oracle.split('|')]
64 summaries = summary.split('|')
65 bodies = body.split('|')
66 icons = icon.split('|')
67
68=== modified file 'notify-osd/notify_osd.xml'
69--- notify-osd/notify_osd.xml 2009-03-22 23:36:18 +0000
70+++ notify-osd/notify_osd.xml 2009-07-22 19:08:16 +0000
71@@ -8,7 +8,7 @@
72 Test the layout of a bubble with an icon, summary and body
73 </description>
74 <args>
75- <oracle>./notify-osd/data/icons_summary_body.png</oracle>
76+ <oracle>data/icons_summary_body.png</oracle>
77 <summary>Nat King Cole</summary>
78 <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?</body>
79 <icon>notification-message-IM</icon>
80@@ -20,7 +20,7 @@
81 Test the layout of a bubble with an icon and summary.
82 </description>
83 <args>
84- <oracle>./notify-osd/data/icons_summary.png</oracle>
85+ <oracle>data/icons_summary.png</oracle>
86 <summary>WiFi connection lost</summary>
87 <body></body>
88 <icon>notification-network-wireless-disconnected</icon>
89@@ -32,7 +32,7 @@
90 Test the layout of a bubble with a summary only.
91 </description>
92 <args>
93- <oracle>./notify-osd/data/summary_body.png</oracle>
94+ <oracle>data/summary_body.png</oracle>
95 <summary>Totem</summary>
96 <body>This is a superfluous notification</body>
97 <icon></icon>
98@@ -44,7 +44,7 @@
99 Test the layout of a bubble with a summary only.
100 </description>
101 <args>
102- <oracle>./notify-osd/data/summary.png</oracle>
103+ <oracle>data/summary.png</oracle>
104 <summary>Summary-only</summary>
105 <body></body>
106 <icon></icon>
107@@ -56,7 +56,7 @@
108 Test the bubble queue.
109 </description>
110 <args>
111- <oracle>./notify-osd/data/icons_summary_body.png|./notify-osd/data/icons_summary.png|./notify-osd/data/summary.png</oracle>
112+ <oracle>data/icons_summary_body.png|data/icons_summary.png|data/summary.png</oracle>
113 <summary>Nat King Cole|WiFi connection lost|Summary-only</summary>
114 <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?||</body>
115 <icon>notification-message-IM|notification-network-wireless-disconnected|</icon>

Subscribers

People subscribed via source and target branches

to status/vote changes: