Merge lp:~elopio/selenium-simple-test/fix-1089498-results_directory into lp:selenium-simple-test

Proposed by Leo Arias
Status: Merged
Approved by: Corey Goldberg
Approved revision: 343
Merged at revision: 338
Proposed branch: lp:~elopio/selenium-simple-test/fix-1089498-results_directory
Merge into: lp:selenium-simple-test
Diff against target: 96 lines (+51/-2)
4 files modified
src/sst/actions.py (+1/-1)
src/sst/runtests.py (+3/-0)
src/sst/tests/test_sst_run.py (+0/-1)
src/sst/tests/test_sst_test_case.py (+47/-0)
To merge this branch: bzr merge lp:~elopio/selenium-simple-test/fix-1089498-results_directory
Reviewer Review Type Date Requested Status
Corey Goldberg (community) Approve
Review via email: mp+141809@code.launchpad.net

Commit message

Create the results directory for SSTTestCases.

Description of the change

Create the results directory for SSTTestCases.

To post a comment you must log in.
340. By Leo Arias

Set a name for the results directory of the test, and remove it afterwards.

341. By Leo Arias

Run the test directly, per Corey's suggestion.

342. By Leo Arias

Do not start the browser.

343. By Leo Arias

It seems clearer to overwrite the start_browser in the test case.

Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

looks good now.

----
all tests passed with:
cgoldberg@zerodown:~/code/fix-1089498-results_directory$ ./ci.sh --bootstrap --flake8 --unit --acceptance

environment info:
Python 2.7.3
Django 1.4.3
Selenium 2.28.0
SST version: 0.2.3dev
Mozilla Firefox 17.0.1
----------------------------------

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/sst/actions.py'
2--- src/sst/actions.py 2013-01-03 17:28:03 +0000
3+++ src/sst/actions.py 2013-01-03 20:59:21 +0000
4@@ -759,7 +759,7 @@
5 except AssertionError as e:
6 pass
7 else:
8- if result != False:
9+ if result is not False:
10 break
11 if time.time() > max_time:
12 error = 'Timed out waiting for: %s' % msg
13
14=== modified file 'src/sst/runtests.py'
15--- src/sst/runtests.py 2012-12-20 23:41:01 +0000
16+++ src/sst/runtests.py 2013-01-03 20:59:21 +0000
17@@ -264,6 +264,7 @@
18 wait_poll = 0.1
19 base_url = None
20
21+ results_directory = _get_full_path('results')
22 screenshots_on = False
23 debug_post_mortem = False
24 extended_report = False
25@@ -280,6 +281,8 @@
26 # a new one for the current test, scheduling the shutdown for the
27 # end of the test.
28 self.xvfb = use_xvfb_server(self)
29+ config.results_directory = self.results_directory
30+ _make_results_dir()
31 self.start_browser()
32 self.addCleanup(self.stop_browser)
33
34
35=== modified file 'src/sst/tests/test_sst_run.py'
36--- src/sst/tests/test_sst_run.py 2012-12-07 09:48:13 +0000
37+++ src/sst/tests/test_sst_run.py 2013-01-03 20:59:21 +0000
38@@ -1,6 +1,5 @@
39 import testtools
40
41-
42 from sst import runtests
43
44
45
46=== added file 'src/sst/tests/test_sst_test_case.py'
47--- src/sst/tests/test_sst_test_case.py 1970-01-01 00:00:00 +0000
48+++ src/sst/tests/test_sst_test_case.py 2013-01-03 20:59:21 +0000
49@@ -0,0 +1,47 @@
50+#!/usr/bin/env python
51+#
52+# Copyright (c) 2013 Canonical Ltd.
53+#
54+# This file is part of: SST (selenium-simple-test)
55+# https://launchpad.net/selenium-simple-test
56+#
57+# Licensed under the Apache License, Version 2.0 (the "License");
58+# you may not use this file except in compliance with the License.
59+# You may obtain a copy of the License at
60+#
61+# http://www.apache.org/licenses/LICENSE-2.0
62+#
63+# Unless required by applicable law or agreed to in writing, software
64+# distributed under the License is distributed on an "AS IS" BASIS,
65+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66+# See the License for the specific language governing permissions and
67+# limitations under the License.
68+
69+import os
70+
71+import testtools
72+
73+from sst import runtests
74+from sst import config
75+
76+
77+class FooSSTTestCase(runtests.SSTTestCase):
78+
79+ def start_browser(self):
80+ # We do not need to start the browser.
81+ pass
82+
83+ def _test_foo(self):
84+ pass
85+
86+
87+class TestSSTTestCase(testtools.TestCase):
88+
89+ def test_results_directory_is_created(self):
90+ test = FooSSTTestCase('_test_foo')
91+ test.results_directory = 'foo_test_results'
92+ test.run()
93+ self.assertEquals(config.results_directory, 'foo_test_results')
94+ self.assertTrue(os.path.exists(config.results_directory))
95+ # Tear down.
96+ os.removedirs(config.results_directory)

Subscribers

People subscribed via source and target branches