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
=== modified file 'src/sst/actions.py'
--- src/sst/actions.py 2013-01-03 17:28:03 +0000
+++ src/sst/actions.py 2013-01-03 20:59:21 +0000
@@ -759,7 +759,7 @@
759 except AssertionError as e:759 except AssertionError as e:
760 pass760 pass
761 else:761 else:
762 if result != False:762 if result is not False:
763 break763 break
764 if time.time() > max_time:764 if time.time() > max_time:
765 error = 'Timed out waiting for: %s' % msg765 error = 'Timed out waiting for: %s' % msg
766766
=== modified file 'src/sst/runtests.py'
--- src/sst/runtests.py 2012-12-20 23:41:01 +0000
+++ src/sst/runtests.py 2013-01-03 20:59:21 +0000
@@ -264,6 +264,7 @@
264 wait_poll = 0.1264 wait_poll = 0.1
265 base_url = None265 base_url = None
266266
267 results_directory = _get_full_path('results')
267 screenshots_on = False268 screenshots_on = False
268 debug_post_mortem = False269 debug_post_mortem = False
269 extended_report = False270 extended_report = False
@@ -280,6 +281,8 @@
280 # a new one for the current test, scheduling the shutdown for the281 # a new one for the current test, scheduling the shutdown for the
281 # end of the test.282 # end of the test.
282 self.xvfb = use_xvfb_server(self)283 self.xvfb = use_xvfb_server(self)
284 config.results_directory = self.results_directory
285 _make_results_dir()
283 self.start_browser()286 self.start_browser()
284 self.addCleanup(self.stop_browser)287 self.addCleanup(self.stop_browser)
285288
286289
=== modified file 'src/sst/tests/test_sst_run.py'
--- src/sst/tests/test_sst_run.py 2012-12-07 09:48:13 +0000
+++ src/sst/tests/test_sst_run.py 2013-01-03 20:59:21 +0000
@@ -1,6 +1,5 @@
1import testtools1import testtools
22
3
4from sst import runtests3from sst import runtests
54
65
76
=== added file 'src/sst/tests/test_sst_test_case.py'
--- src/sst/tests/test_sst_test_case.py 1970-01-01 00:00:00 +0000
+++ src/sst/tests/test_sst_test_case.py 2013-01-03 20:59:21 +0000
@@ -0,0 +1,47 @@
1#!/usr/bin/env python
2#
3# Copyright (c) 2013 Canonical Ltd.
4#
5# This file is part of: SST (selenium-simple-test)
6# https://launchpad.net/selenium-simple-test
7#
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19
20import os
21
22import testtools
23
24from sst import runtests
25from sst import config
26
27
28class FooSSTTestCase(runtests.SSTTestCase):
29
30 def start_browser(self):
31 # We do not need to start the browser.
32 pass
33
34 def _test_foo(self):
35 pass
36
37
38class TestSSTTestCase(testtools.TestCase):
39
40 def test_results_directory_is_created(self):
41 test = FooSSTTestCase('_test_foo')
42 test.results_directory = 'foo_test_results'
43 test.run()
44 self.assertEquals(config.results_directory, 'foo_test_results')
45 self.assertTrue(os.path.exists(config.results_directory))
46 # Tear down.
47 os.removedirs(config.results_directory)

Subscribers

People subscribed via source and target branches