Revision: 133
Author: jprantan
Date: Tue Jun 29 04:47:13 2010
Log: cleanup
http://code.google.com/p/robotframework-mabot/source/detail?r=133
Modified:
/trunk/utest/run_unit_tests.py
/trunk/utest/test_LockFile.py
/trunk/utest/test_data_conversion.py
/trunk/utest/test_get_includes_and_excludes_from_pattern.py
/trunk/utest/test_io.py
/trunk/utest/test_model.py
/trunk/utest/test_model_tags.py
/trunk/utest/test_setting_and_getting_status_and_message.py
/trunk/utest/test_settings.py
/trunk/utest/test_settings_utils.py
/trunk/utest/test_ui_tree.py
=======================================
--- /trunk/utest/run_unit_tests.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/run_unit_tests.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,7 +19,7 @@
usage: run_unit_tests.py [options]
-options:
+options:
-q, --quiet Minimal output
-v, --verbose Verbose output
-d, --doc Show test's doc string instead of name and class
@@ -35,8 +35,8 @@
path = os.path.join(base, path.replace('/', os.sep))
if path not in sys.path:
sys.path.insert(0, path)
-
-testfile = re.compile("^test_.*\.py$", re.IGNORECASE)
+
+testfile = re.compile("^test_.*\.py$", re.IGNORECASE)
def get_tests(directory=None):
@@ -55,14 +55,14 @@
modules.append(__import__(modname))
tests.extend([ unittest.defaultTestLoader.loadTestsFromModule(module)
for module in modules ])
- return tests
+ return tests
def parse_args(argv):
docs = 0
verbosity = 1
try:
- options, args = getopt.getopt(argv, 'hH?vqd',
+ options, args = getopt.getopt(argv, 'hH?vqd',
['help','verbose','quiet','doc'])
if len(args) != 0:
raise getopt.error, 'no arguments accepted, got %s' % (args)
=======================================
--- /trunk/utest/test_LockFile.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_LockFile.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,12 +20,12 @@
class MockLockFile(LockFile):
-
+
def __init__(self, path, time, user):
self.time = time
self.user = user
LockFile.__init__(self, path)
-
+
def _get_time(self):
return self.time
@@ -33,7 +33,7 @@
return self.user
class MockLockWriting(MockLockFile):
-
+
def _write(self, path, content):
raise Exception("Writing to file failed!")
@@ -66,11 +66,11 @@
content = lock.read()
lock.close()
return content
-
+
def tearDown(self):
self._remove_lock()
-
+
def test_create_lock_no_lock_1(self):
value = self.lock.create_lock(MockDialog(True).dialog)
self.assertEqual(value, self.expected1)
@@ -80,7 +80,7 @@
value = self.lock.create_lock(MockDialog(False).dialog)
self.assertEqual(value, self.expected1)
self.assertTrue(os.path.exists(self.lock_path))
-
+
def test_create_lock_lock_is_not_override(self):
lock_file_content = self.lock.create_lock(MockDialog(True).dialog)
self.assertEqual(lock_file_content, self.expected1)
@@ -95,7 +95,7 @@
lock_file_content_2 =
self.lock2.create_lock(MockDialog(True).dialog)
self.assertEqual(lock_file_content_2, self.expected2)
self.assertTrue(os.path.exists(self.lock_path))
-
+
def test_release_log(self):
lock_file_content_1 =
self.lock.create_lock(MockDialog(True).dialog)
self.assertEqual(lock_file_content_1, self.expected1)
@@ -109,15 +109,15 @@
class MockDialog:
-
+
def __init__(self, return_value):
self.return_value = return_value
-
+
def dialog(self, title, message):
self.title = title
self.message = message
return self.return_value
-
+
if __name__ == "__main__":
unittest.main()
=======================================
--- /trunk/utest/test_data_conversion.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_data_conversion.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,13 +39,13 @@
def test_link_with_data_both_sides(self):
text = 'hello\n\n\nhttp://www.google.com world!\n'
_equals(get_text_parts(text), (('hello\n\n\n', 'normal'),
- ('http://www.google.com', 'link'),
+ ('http://www.google.com', 'link'),
(' world!\n', 'normal')))
def test_multiple_links(self):
text = 'hello http://www.google.com world!\n other http://my.com'
_equals(get_text_parts(text), (('hello ', 'normal'),
- ('http://www.google.com', 'link'),
+ ('http://www.google.com', 'link'),
(' world!\n other ', 'normal'),
('http://my.com', 'link')))
@@ -56,12 +56,12 @@
def test_two_bolds(self):
text = 'some *hello* other *bold*\n'
- _equals(get_text_parts(text), (('some', 'normal'), ('
hello ', 'bold'),
+ _equals(get_text_parts(text), (('some', 'normal'), ('
hello ', 'bold'),
('other', 'normal'), ('
bold\n', 'bold')))
def test_two_italics(self):
text = 'some _hello_ other _bold_\n'
- _equals(get_text_parts(text), (('some', 'normal'), ('
hello ', 'italic'),
+ _equals(get_text_parts(text), (('some', 'normal'), ('
hello ', 'italic'),
('other', 'normal'), ('
bold\n', 'italic')))
def test_file_name_with_underscores(self):
@@ -72,7 +72,7 @@
starttime = time.time()
_equals(get_text_parts(long_message), ((long_message, 'normal'), ))
self.assertTrue(time.time() - starttime < 2)
-
+
long_message = """
some asjdkasjd alkjshd ksaj hdksad hkjsa hdksaj hdksaj hdksahd ksaj hdksaj
hdk
----------asdkjsadk jhaskd hksaj hdksa hdksaj hd --hh as-d h-as hd-sal
dhsald h
=======================================
--- /trunk/utest/test_get_includes_and_excludes_from_pattern.py Tue Jun 29
04:42:43 2010
+++ /trunk/utest/test_get_includes_and_excludes_from_pattern.py Tue Jun 29
04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,28 +32,28 @@
self._test_pattern('againNOThelloNOTNOTsome', [], ['*'])
def test_multiple_includes(self):
- self._test_pattern('helloANDsome&again',
+ self._test_pattern('helloANDsome&again',
['hello&some&again'], [])
def test_include_and_exclude(self):
self._test_pattern('*NOThello', ['*'], ['hello'])
def test_include_and_multiple_excludes(self):
- self._test_pattern('*NOThelloNOTsomeNOTagain', ['*'],
+ self._test_pattern('*NOThelloNOTsomeNOTagain', ['*'],
['hello', 'some', 'again'])
def test_multiple_includes_and_exclude(self):
self._test_pattern('helloANDsomeNOTagain', ['hello&some'],
['again'])
def test_multiple_includes_and_multiple_excludes(self):
- self._test_pattern('helloANDsomeNOTagainNOTmore',
+ self._test_pattern('helloANDsomeNOTagainNOTmore',
['hello&some'], ['again', 'more'])
def _test_pattern(self, pattern, includes, excludes):
expected = (includes, excludes)
actual = get_includes_and_excludes_from_pattern(pattern)
self.assertEquals(expected, actual, '\n%s !=\n%s' % (expected,
actual))
-
-
+
+
if __name__ == "__main__":
unittest.main()
=======================================
--- /trunk/utest/test_io.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_io.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
from mabot.model import io
from mabot.model.model import DATA_MODIFIED
-
+
DATA_FOLDER = normcase(join(dirname(__file__), 'data',))
SUITES_FOLDER = join(DATA_FOLDER, 'suites')
SUITES_FOLDER_WITH_OS_SEP = SUITES_FOLDER + os.sep
@@ -54,7 +54,7 @@
def tearDown(self):
DATA_MODIFIED.saved()
io.SETTINGS = self.orig_settings
-
+
def _test_loading(self, source, name):
suite = self.io.load_data(source)
self.assertEqual(suite.name, name)
@@ -68,7 +68,7 @@
class TestLoadData(_TestIO):
-
+
def test_load_data_without_datasources(self):
suite = self._test_loading(None, '')
@@ -78,7 +78,7 @@
def test_load_data_with_only_html_datasource_and_xml_loading_on(self):
io.SETTINGS["always_load_old_data_from_xml"] = True
suite = self._test_loading(HTML_DATASOURCE_ONLY, 'Testcases')
-
+
def test_load_data_with_only_tsv_datasource(self):
suite = self._test_loading(TSV_DATASOURCE_ONLY, 'Tsv Testcases')
@@ -102,8 +102,8 @@
def test_load_datasource_and_xml_with_updates_in_html(self):
io.SETTINGS["always_load_old_data_from_xml"] = True
- suite = self._test_loading(HTML_DATASOURCE_WITH_UPDATES,
- 'Html With Updates')
+ suite = self._test_loading(HTML_DATASOURCE_WITH_UPDATES,
+ 'Html With Updates')
self.assertEquals(len(suite.tests), 2)
self.assertEquals(suite.tests[0].message, 'Failure!')
self.assertTrue(DATA_MODIFIED.is_modified(),
@@ -119,7 +119,7 @@
msg = "Found test 'TC' from suite 'Same Test Name' 2 times.\n"
msg += "Mabot supports only unique test case names!\n"
self._test_error(SAME_TEST_NAME, msg)
-
+
def test_load_data_with_html_suite_with_dublicate_keywords(self):
msg = "Could not create keyword 'UK' in testcase 'Duplicate
Keywords.TC1'."
@@ -135,13 +135,13 @@
self._test_error(NON_EXISTING_XML, msg)
def
test_load_data_with_non_existing_datasource_with_xml_loading_on(self):
- io.SETTINGS["always_load_old_data_from_xml"] = True
+ io.SETTINGS["always_load_old_data_from_xml"] = True
msg = "Path '%s' does not exist!" % (NON_EXISTING_DATASOURCE)
self._test_error(NON_EXISTING_DATASOURCE, msg)
def test_load_data_with_invalid_datasource_and_valid_xml(self):
io.SETTINGS["include"] = ['no-tag']
- io.SETTINGS["always_load_old_data_from_xml"] = True
+ io.SETTINGS["always_load_old_data_from_xml"] = True
msg = "Suite 'Testcases2' with includes 'no-tag' contains no test
cases.\n"
self._test_error(HTML_DATASOURCE_WITH_XML, msg)
@@ -167,48 +167,48 @@
class TestGetDatasourceAndXml(_TestIO):
def test_get_datasource_and_xml_from_xml(self):
-
self.assertEqual(self.io._get_datasource_and_xml_from(XML_DATASOURCE_ONLY),
+
self.assertEqual(self.io._get_datasource_and_xml_from(XML_DATASOURCE_ONLY),
(None, XML_DATASOURCE_ONLY))
def test_get_datasource_and_xml_from_html_loading_off(self):
io.SETTINGS["always_load_old_data_from_xml"] = False
-
self.assertEqual(self.io._get_datasource_and_xml_from(HTML_DATASOURCE_WITH_XML),
+
self.assertEqual(self.io._get_datasource_and_xml_from(HTML_DATASOURCE_WITH_XML),
(HTML_DATASOURCE_WITH_XML, None))
def test_get_datasource_and_xml_from_html(self):
io.SETTINGS["always_load_old_data_from_xml"] = True
-
self.assertEqual(self.io._get_datasource_and_xml_from(HTML_DATASOURCE_WITH_XML),
- (HTML_DATASOURCE_WITH_XML,
+
self.assertEqual(self.io._get_datasource_and_xml_from(HTML_DATASOURCE_WITH_XML),
+ (HTML_DATASOURCE_WITH_XML,
HTML_DATASOURCE_WITH_XML.replace('.html', '.xml')))
def test_get_datasource_and_xml_from_dir_without_os_sep(self):
io.SETTINGS["always_load_old_data_from_xml"] = True
-
self.assertEqual(self.io._get_datasource_and_xml_from(SUITES_FOLDER),
+
self.assertEqual(self.io._get_datasource_and_xml_from(SUITES_FOLDER),
(SUITES_FOLDER, SUITES_FOLDER+'.xml'))
def test_get_datasource_and_xml_from_dir_ending_with_os_sep(self):
io.SETTINGS["always_load_old_data_from_xml"] = True
folder = SUITES_FOLDER.endswith(os.sep) and SUITES_FOLDER
-
self.assertEqual(self.io._get_datasource_and_xml_from(SUITES_FOLDER_WITH_OS_SEP),
+
self.assertEqual(self.io._get_datasource_and_xml_from(SUITES_FOLDER_WITH_OS_SEP),
(SUITES_FOLDER, SUITES_FOLDER+'.xml'))
def test_get_datasource_and_xml_from_tsv(self):
io.SETTINGS["always_load_old_data_from_xml"] = True
-
self.assertEqual(self.io._get_datasource_and_xml_from(TSV_DATASOURCE_ONLY),
+
self.assertEqual(self.io._get_datasource_and_xml_from(TSV_DATASOURCE_ONLY),
(TSV_DATASOURCE_ONLY,
TSV_DATASOURCE_ONLY.replace('.tsv', '.xml')))
def test_get_datasource_and_xml_from_txt(self):
msg = "Path '%s' is not in supported format!\nSupported formats" %
(TEXT_DATASOURCE)
msg += " are HTML, TSV, XML and Robot Framework's test suite
directory."
- self._test_error(TEXT_DATASOURCE, msg,
+ self._test_error(TEXT_DATASOURCE, msg,
self.io._get_datasource_and_xml_from)
def test_get_datasource_and_xml_from_non_existing_file(self):
msg = "Path '%s' does not exist!" % (NON_EXISTING_DATASOURCE)
- self._test_error(NON_EXISTING_DATASOURCE, msg,
+ self._test_error(NON_EXISTING_DATASOURCE, msg,
self.io._get_datasource_and_xml_from)
-
-
+
+
class TestBackUp(_TestIO):
def setUp(self):
@@ -217,11 +217,11 @@
self.orig_get_timestamp = self.io._get_timestamp
self.io._get_timestamp = self._get_timestamp
io.SETTINGS["always_load_old_data_from_xml"] = True
-
-
+
+
def tearDown(self):
_TestIO.tearDown(self)
- self.io._get_timestamp = self.orig_get_timestamp
+ self.io._get_timestamp = self.orig_get_timestamp
for path in self.remove_files:
if os.path.exists(path):
os.remove(path)
@@ -289,7 +289,7 @@
data = f.read()
f.close()
return data
-
+
def _write(self, path, data):
f = open(path, 'w')
f.write(data)
@@ -299,7 +299,7 @@
return '20090114092000'
class TestGetTimeStamp(_TestIO):
-
+
def test_get_timestamp(self):
timestamp = self.io._get_timestamp()
self.assertEquals(len(timestamp), 14)
=======================================
--- /trunk/utest/test_model.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_model.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,10 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,35 +19,35 @@
from robot.common.model import BaseTestSuite, BaseTestCase
from mabot.model.io import IO
-from mabot.model import model
+from mabot.model import model
class _TestAddingData(unittest.TestCase):
def setUp(self):
data = normcase(join(dirname(__file__), 'data', 'root_suite'))
self.suite = IO().load_data(data)
- self.other_suite = deepcopy(self.suite)
+ self.other_suite = deepcopy(self.suite)
self.test = self.suite.suites[1].tests[0]
self.other_test = deepcopy(self.test)
-
+
def tearDown(self):
model.DATA_MODIFIED.status = False
class TestAddDataFromOtherItem(_TestAddingData):
-
+
def test_adding_suites_sub_suites(self):
self.other_suite.suites[1].tests[0].set_all('PASS')
- self.suite.add_results(self.other_suite)
+ self.suite.add_results(self.other_suite)
self.assertEquals(self.suite.suites[1].tests[0].status, 'PASS')
- def test_adding_suites_tests(self):
+ def test_adding_suites_tests(self):
self.other_suite.suites[1].tests[0].set_all('PASS')
self.suite.add_results(self.other_suite)
self.assertEquals(self.suite.suites[0].tests[0].status, 'FAIL')
self.assertEquals(self.suite.suites[1].tests[0].status, 'PASS')
- def
test_adding_suites_tests_with_new_test_with_not_adding_missing(self):
+ def
test_adding_suites_tests_with_new_test_with_not_adding_missing(self):
test = deepcopy(self.other_suite.suites[0].tests[0])
test.name = 'Added Test'
self.other_suite.suites[0].tests.append(test)
@@ -57,7 +56,7 @@
self.assertNotEquals(self.suite.suites[0].tests[0].name, 'Added
Test')
self.assertEquals(model.DATA_MODIFIED.is_modified(), True)
- def
test_adding_suites_tests_with_new_test_to_end_with_adding_missing(self):
+ def
test_adding_suites_tests_with_new_test_to_end_with_adding_missing(self):
test = deepcopy(self.other_suite.suites[0].tests[0])
test.name = 'Added Test'
self.other_suite.suites[0].tests.append(test)
@@ -66,23 +65,23 @@
self.assertEquals(self.suite.suites[0].tests[1].name, 'Added Test')
self.assertEquals(model.DATA_MODIFIED.is_modified(), False)
- def
test_adding_suites_tests_with_new_test_to_beginning_with_adding_missing(self):
+ def
test_adding_suites_tests_with_new_test_to_beginning_with_adding_missing(self):
test = deepcopy(self.other_suite.suites[0].tests[0])
test.name = 'Added Test'
self.other_suite.suites[0].tests.insert(0, test)
self.suite.add_results(self.other_suite, add_from_xml=True)
self.assertEquals(len(self.suite.suites[0].tests), 2)
- self.assertEquals(self.suite.suites[0].tests[1].name, 'Added Test',
- "Should be added at the end, because there is no
order.")
+ self.assertEquals(self.suite.suites[0].tests[1].name, 'Added Test',
+ "Should be added at the end, because there is no
order.")
self.assertEquals(model.DATA_MODIFIED.is_modified(), False)
- def test_adding_suites_tests_with_removed_test_in_beginning(self):
+ def test_adding_suites_tests_with_removed_test_in_beginning(self):
self._test_removed_test(0, False)
- def
test_adding_suites_tests_with_removed_test_in_beginning_with_adding_missing(self):
+ def
test_adding_suites_tests_with_removed_test_in_beginning_with_adding_missing(self):
self._test_removed_test(0, True)
- def test_adding_suites_tests_with_removed_test_in_middle(self):
+ def test_adding_suites_tests_with_removed_test_in_middle(self):
self._test_removed_test(1, False)
def
test_adding_suites_tests_with_removed_test_in_middle_with_adding_missing(self):
@@ -99,11 +98,11 @@
self.other_suite.suites[2].tests.pop(index)
self.suite.add_results(self.other_suite)
self.assertEquals(len(self.suite.suites[2].tests), 3)
- self.assertEquals(self.suite.suites[2].tests[0].status,
+ self.assertEquals(self.suite.suites[2].tests[0].status,
index == 0 and 'FAIL' or 'PASS')
- self.assertEquals(self.suite.suites[2].tests[1].status,
+ self.assertEquals(self.suite.suites[2].tests[1].status,
index == 1 and 'FAIL' or 'PASS')
- self.assertEquals(self.suite.suites[2].tests[2].status,
+ self.assertEquals(self.suite.suites[2].tests[2].status,
index == 2 and 'FAIL' or 'PASS')
def test_adding_suites_sub_suites_with_new_sub_suite(self):
@@ -114,7 +113,7 @@
self.assertEquals(len(self.suite.suites), 3)
self.assertFalse('Added Test' in [s.name for s in
self.suite.suites],
"When add_from_xml is false, suite should not be
added!")
-
+
def
test_adding_suites_sub_suites_with_new_sub_suite_with_adding_missing(self):
suite = deepcopy(self.other_suite.suites[0])
suite.name = 'Added Suite'
@@ -136,7 +135,7 @@
self.assertEquals(self.suite.suites[0].tests[0].status, 'PASS')
self.assertEquals(self.suite.suites[1].tests[0].status, 'FAIL')
self.assertEquals(self.suite.suites[2].tests[0].status, 'PASS')
-
+
def test_adding_tests_status_and_message(self):
test = self.other_suite.suites[2].tests[1]
test.message = 'New Message'
@@ -153,7 +152,7 @@
self.assertEquals(self.suite.suites[2].tests[1].starttime,
test.starttime)
self.assertEquals(self.suite.suites[2].tests[1].endtime,
test.endtime)
- def test_adding_test_results_when_tags_added(self):
+ def test_adding_test_results_when_tags_added(self):
test = self.suite.suites[0].tests[0]
other_test = deepcopy(test)
other_test.tags.append('new-tag')
@@ -177,7 +176,7 @@
test.add_results(other_test, False, None)
self.assertEquals(test.tags,
['new-tag', 'tag-1', 'tag-2', 'tag-3'])
self.assertTrue(test.is_modified)
-
+
def test_adding_tests_keywords(self):
self.other_suite.suites[1].tests[0].set_all('PASS')
self.suite.add_results(self.other_suite)
@@ -209,7 +208,7 @@
other_test.keywords.append(kw)
self._add_info(other_test)
test.add_results(other_test, True, True)
- self._tests_are_unequal(test, other_test)
+ self._tests_are_unequal(test, other_test)
self.assertEquals(model.DATA_MODIFIED.is_modified(), False)
def _add_info(self, test):
@@ -263,7 +262,7 @@
class TestSavingWhenChangesInKeywords(_TestAddingData):
-
+
def setUp(self):
self._orig_dialog = model.tkMessageBox
self.dialog = MockDialog()
@@ -294,7 +293,7 @@
self.assertEquals(len(self.dialog.messages), 0)
self.assertTrue('extra' in self.other_test.tags)
self.assertTrue(self.other_test.is_modified)
-
+
def
test_changes_in_kws_and_saving_data_when_own_kws_old_and_others_old(self):
self.test.keywords.pop(2)
self.test.add_results(self.other_test, True, self.dialog.call)
@@ -332,7 +331,7 @@
def setUp(self):
_TestAddingData.setUp(self)
self.mock = MockDialog()
-
+
def test_load_other_when_starting_eq_no_override_method(self):
self.assertTrue(self.test._load_other(self.other_test, None))
@@ -369,7 +368,7 @@
Tags: tag-1, tag-2
Do you want your changes to be overridden?"""
- self.assertEqual(self.mock.messages[0],
+ self.assertEqual(self.mock.messages[0],
("Conflicting Test Results!", expected))
def
test_load_other_when_both_have_modifications_status_is_different(self):
@@ -391,7 +390,7 @@
class TestLoadOtherWithKeywords(_TestAddingData):
-
+
def setUp(self):
_TestAddingData.setUp(self)
self.kw = self.test.keywords[0]
@@ -404,8 +403,8 @@
def test_load_other_with_keywords(self):
self.assertTrue(self.kw._load_other(self.other_kw, self.mock.call))
- self.assertEqual(self.mock.messages[0],
-
self.kw._create_message_for_duplicate_results(self.other_kw))
+ self.assertEqual(self.mock.messages[0],
+
self.kw._create_message_for_duplicate_results(self.other_kw))
self.assertTrue('Status: PASS\n' in self.mock.messages[0][1])
self.assertTrue('Message: working\n' in self.mock.messages[0][1])
@@ -427,7 +426,7 @@
def setUp(self):
data = normcase(join(dirname(__file__), 'data', 'root_suite'))
self.suite = IO().load_data(data)
-
+
def test_getting_tags_from_test_with_tags_and_tags_empty(self):
test = self.suite.suites[0].tests[0]
tags = []
@@ -481,7 +480,7 @@
self.assertEquals(['tag-1', 'tag-2', 'tag-3'], tags)
class MockDialog:
-
+
def __init__(self):
self.return_ = True
self.messages = []
=======================================
--- /trunk/utest/test_model_tags.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_model_tags.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,11 +28,11 @@
self.suite = IO().load_data(data)
self.test = self.suite.suites[1].tests[0]
self.orig_settings = deepcopy(model.SETTINGS)
-
+
def tearDown(self):
model.SETTINGS = self.orig_settings
-
- def _test_tags(self, initial_tags, method, input, expected,
+
+ def _test_tags(self, initial_tags, method, input, expected,
tags_allowed_only_once=[]):
self.test.tags = initial_tags[:]
model.SETTINGS["tags_allowed_only_once"] = tags_allowed_only_once
@@ -40,12 +40,12 @@
self.assertEquals(self.test.tags, expected)
class TestAddingTags(_TestAddAndRemoveTags):
-
- def _test_add_tags(self, initial_tags, input, expected,
+
+ def _test_add_tags(self, initial_tags, input, expected,
tags_allowed_only_once=[]):
- self._test_tags(initial_tags, self.test.add_tags, input, expected,
+ self._test_tags(initial_tags, self.test.add_tags, input, expected,
tags_allowed_only_once)
-
+
def test_adding_tags_when_no_only_once_tags_defined(self):
self._test_add_tags([], ['foo'], ['foo'])
@@ -53,26 +53,26 @@
self._test_add_tags([], ['foo'], ['foo'])
def test_adding_tag_in_only_once_tags_but_no_tags_to_remove(self):
- self._test_add_tags(['bar'], ['not-foo'],
+ self._test_add_tags(['bar'], ['not-foo'],
['bar', 'not-foo'], ['not-'])
def test_adding_tag_in_only_once_tags_and_one_tag_to_remove(self):
- self._test_add_tags(['not-bar'], ['not-foo'],
+ self._test_add_tags(['not-bar'], ['not-foo'],
['not-foo'], ['not-'])
def test_adding_tag_in_only_once_tags_and_three_tags_to_remove(self):
- self._test_add_tags(['tag-1', 'tag-2', 'tag-3'], ['tag-foo'],
+ self._test_add_tags(['tag-1', 'tag-2', 'tag-3'], ['tag-foo'],
['tag-foo'], ['tag-'])
-
+
def
test_adding_multiple_tags_some_matching_only_once_tags_and_not_tags_to_remove(self):
- self._test_add_tags(['tag-1', 'tag-2'],
['some', 'build-x', 'reg-2'],
- ['build-x', 'reg-2', 'some', 'tag-1', 'tag-2'],
+ self._test_add_tags(['tag-1', 'tag-2'],
['some', 'build-x', 'reg-2'],
+ ['build-x', 'reg-2', 'some', 'tag-1', 'tag-2'],
['req-', 'build'])
def
test_adding_multiple_tags_some_matching_only_once_tags_and_one_tag_to_remove(self):
self._test_add_tags(['tag-1', 'tag-2', 'build-y'],
- ['some', 'build-x', 'reg-2'],
- ['build-x', 'reg-2', 'some', 'tag-1', 'tag-2'],
+ ['some', 'build-x', 'reg-2'],
+ ['build-x', 'reg-2', 'some', 'tag-1', 'tag-2'],
['req-', 'build'])
def
test_adding_multiple_tags_some_matching_only_once_tags_and_multiple_tags_to_remove(self):
@@ -81,17 +81,17 @@
add_tags =
['build-y', 'executed-by-bond', 'req-2', 'some', 'tag-4']
expected = ['build-y', 'executed-by-bond', 'other',
'req-1', 'req-2', 'some', 'tag-4']
- self._test_add_tags(initial_tags, add_tags, expected,
+ self._test_add_tags(initial_tags, add_tags, expected,
['tag-', 'build-', 'executed-by-'])
-
+
def test_adding_tags_to_suite(self):
- self._test_tags(['some', 'other'], self.suite.add_tags,
['foo', 'bar'],
+ self._test_tags(['some', 'other'], self.suite.add_tags,
['foo', 'bar'],
['bar', 'foo', 'other', 'some'])
self.assertTrue(self.test.is_modified)
def test_adding_tags_to_suite_when_it_is_not_visible(self):
self.suite.visible = False
- self._test_tags(['some', 'other'], self.suite.add_tags,
['foo', 'bar'],
+ self._test_tags(['some', 'other'], self.suite.add_tags,
['foo', 'bar'],
['some', 'other'])
self.assertFalse(self.test.is_modified)
@@ -99,17 +99,17 @@
self.test.visible = False
self._test_add_tags(['some', 'other'], ['foo', 'bar'],
['some', 'other'])
self.assertFalse(self.test.is_modified)
-
+
def test_test_is_marked_as_modified_when_tags_are_added(self):
self._test_add_tags(['some'], ['bar'], ['bar', 'some'])
self.assertTrue(self.test.is_modified)
class TestRemovingTags(_TestAddAndRemoveTags):
-
+
def _test_remove_tags(self, initial_tags, input, expected):
self._test_tags(initial_tags, self.test.remove_tags, input,
expected)
-
+
def test_removing_tags_no_tags_matching_found(self):
self._test_remove_tags(['some'], ['bar'], ['some'])
self.assertFalse(self.test.is_modified)
@@ -119,7 +119,7 @@
self.assertTrue(self.test.is_modified)
def test_removing_tags_three_removed(self):
- self._test_remove_tags(['some', 'more', 'tags'], ['some', 'tags'],
+ self._test_remove_tags(['some', 'more', 'tags'], ['some', 'tags'],
['more'])
self.assertTrue(self.test.is_modified)
@@ -127,15 +127,15 @@
self.test.visible = False
self._test_remove_tags(['some'], ['some'], ['some'])
self.assertFalse(self.test.is_modified)
-
+
def test_adding_tags_to_suite(self):
- self._test_tags(['some', 'tag'], self.suite.remove_tags,
['foo', 'some'],
+ self._test_tags(['some', 'tag'], self.suite.remove_tags,
['foo', 'some'],
['tag'])
self.assertTrue(self.test.is_modified)
def test_adding_tags_to_suite_when_it_is_not_visible(self):
self.suite.visible = False
- self._test_tags(['some', 'tag'], self.suite.remove_tags,
['foo', 'some'],
+ self._test_tags(['some', 'tag'], self.suite.remove_tags,
['foo', 'some'],
['some', 'tag'])
self.assertFalse(self.test.is_modified)
@@ -148,7 +148,7 @@
self.test.tags = ['bar']
self.kw = self.test.keywords[0].keywords[0]
- def test_if_test_is_executed_tags_are_added(self):
+ def test_if_test_is_executed_tags_are_added(self):
self.test._mark_data_modified(executed=True)
self._tags_are_added_to_test()
@@ -157,11 +157,11 @@
self.assertEquals(self.test.tags, ['bar'])
self.assertTrue(self.test.is_modified)
- def test_if_keyword_message_is_changed_tags_are_added(self):
+ def test_if_keyword_message_is_changed_tags_are_added(self):
self.kw.set_message('New message')
self._tags_are_added_to_test()
- def
test_if_only_keyword_message_and_not_status_is_changed_tags_are_added(self):
+ def
test_if_only_keyword_message_and_not_status_is_changed_tags_are_added(self):
self.kw.update_status_and_message(message='New message')
self._tags_are_added_to_test()
=======================================
--- /trunk/utest/test_setting_and_getting_status_and_message.py Tue Jun 29
04:42:43 2010
+++ /trunk/utest/test_setting_and_getting_status_and_message.py Tue Jun 29
04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,11 +24,11 @@
class TestSettingStatusAndMessage(unittest.TestCase):
-
+
def setUp(self):
self.io = io.IO()
self.suite = self.io.load_data(DATA)
-
+
def tearDown(self):
DATA_MODIFIED.saved()
@@ -42,16 +42,16 @@
self._messages_should_be(self.suite.tests[1].keywords,
expected_messages)
self._messages_should_be(self.suite.tests[2].keywords,
expected_messages)
self._messages_should_be(self.suite.tests[3].keywords,
expected_messages)
-
+
def test_fail_all_with_suite(self):
self.suite.set_all('FAIL', 'Suite failure')
self._all_status_should_be(self.suite, 'FAIL')
- expected_messages = ['Suite failure\nPassing', 'Suite failure',
+ expected_messages = ['Suite failure\nPassing', 'Suite failure',
'Suite failure\nFailing', 'Suite failure']
self._messages_should_be(self.suite.tests, expected_messages)
for i in range(0, 4):
- self._messages_should_be(self.suite.tests[i].keywords,
+ self._messages_should_be(self.suite.tests[i].keywords,
expected_messages)
def test_fail_all_with_test(self):
@@ -65,7 +65,7 @@
test = self.suite.tests[0]
test.set_all('FAIL', 'Test failure')
self._all_status_should_be(test, 'FAIL')
- expected_messages = ['Test failure\nPassing', 'Test failure',
+ expected_messages = ['Test failure\nPassing', 'Test failure',
'Test failure\nFailing', 'Test failure']
self._messages_should_be(test.keywords, expected_messages)
@@ -107,13 +107,13 @@
self.assertEqual(test.status, 'PASS')
self.assertEqual(test.message, 'Hello')
self._should_be_modified(test)
-
+
def test_change_nothing_from_test(self):
test = self.suite.tests[0]
test.update_status_and_message('PASS', ' Passing \n')
self.assertEqual(test.status, 'PASS')
self._should_not_be_modified(test)
-
+
def test_suite_status_is_changed_when_test_statuses_are_changed(self):
self.suite.tests[2].update_status_and_message('PASS', '')
self.assertEqual(self.suite.status, 'FAIL')
@@ -143,7 +143,7 @@
def _should_not_be_modified(self, item):
self.assertFalse(item.is_modified)
self.assertFalse(DATA_MODIFIED.is_modified())
-
+
def _all_status_should_be(self, item, status):
msg = "'%s' status was '%s', it should be '%s'"
name = getattr(item, 'longname', item.name)
@@ -151,23 +151,23 @@
self.assertEqual(item.status, status, msg)
for sub_item in item._get_items():
self._all_status_should_be(sub_item, status)
-
+
def _messages_should_be(self, items, messages):
for item, message in zip(items, messages):
msg = "'%s' message was '%s', it should be '%s'"
- name = getattr(item, 'longname', item.parent.longname+'.'+
item.name)
+ name = getattr(item, 'longname', item.parent.longname+'.'+
item.name)
msg = msg % (name, item.message, message)
self.assertEqual(item.message, message, msg)
class TestGetExecutionStatus(unittest.TestCase):
-
+
def setUp(self):
self.io = io.IO()
self.suite = self.io.load_data(DATA)
-
+
def tearDown(self):
DATA_MODIFIED.saved()
-
+
def test_get_execution_status_not_executed_with_suite(self):
self.suite.tests[3].keywords[2].message = ''
self.assertEqual(self.suite.get_execution_status(), 'NOT_EXECUTED')
@@ -186,7 +186,7 @@
self.suite.tests[3].visible = False
self.suite.tests[4].visible = False
self.assertEqual(self.suite.get_execution_status(), 'PASS')
-
+
def test_get_execution_status_not_executed_with_test(self):
test = self.suite.tests[3]
@@ -202,17 +202,17 @@
self.assertEqual(test.get_execution_status(), 'PASS')
def test_get_execution_status_not_executed_with_kw(self):
-
self.assertEqual(self.suite.tests[0].keywords[3].get_execution_status(),
+
self.assertEqual(self.suite.tests[0].keywords[3].get_execution_status(),
'NOT_EXECUTED')
-
+
def test_get_execution_status_failed_with_kw(self):
-
self.assertEqual(self.suite.tests[0].keywords[2].get_execution_status(),
+
self.assertEqual(self.suite.tests[0].keywords[2].get_execution_status(),
'FAIL')
def test_get_execution_status_passed_with_kw(self):
-
self.assertEqual(self.suite.tests[0].keywords[1].get_execution_status(),
+
self.assertEqual(self.suite.tests[0].keywords[1].get_execution_status(),
'PASS')
-
+
if __name__ == "__main__":
unittest.main()
=======================================
--- /trunk/utest/test_settings.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_settings.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@
class _TestSettings(unittest.TestCase):
def setUp(self):
- self.path = os.path.join(os.path.dirname(__file__), 'data',
+ self.path = os.path.join(os.path.dirname(__file__), 'data',
'testsettings.py')
self._remove_settings()
self.settings = Settings(self.path)
@@ -40,7 +40,7 @@
if os.path.exists(self.path):
os.remove(self.path)
-
+
class TestSettings(_TestSettings):
def test_loading_default_settings(self):
@@ -48,12 +48,12 @@
self.assertEquals(self.settings._settings, expected)
self.assertEquals(self.settings._settings["include"], [])
self.assertEquals(self.settings._settings["exclude"], [])
- self.assertEquals(self.settings._settings["default_message"],
+ self.assertEquals(self.settings._settings["default_message"],
"Not Executed!")
-
+
def test_saving_with_default_settings(self):
self.settings.save()
- self.assertEquals(self.settings._settings,
+ self.assertEquals(self.settings._settings,
self._read_settings_from_file())
def test_saving_with_modified_settings(self):
@@ -68,7 +68,7 @@
self.assertEquals(self.settings._settings["exclude"],
["a", "b", "c"])
self.settings.load()
self.assertEquals(self.settings._settings, settings)
-
+
def test_reverting_default_settings(self):
defaults = self.settings._settings.copy()
self.settings._settings["default_message"] = "My message"
@@ -84,7 +84,7 @@
defaults = {'default_message':"Not Executed!"}
self.settings.update_settings(defaults, self.suite)
self.assertEquals(self.suite.called, [('Not Executed!', 'Not
Executed!')])
-
+
def
test_update_settings_affects_suite_when_default_message_is_changed(self):
not_defaults = {'default_message':"New"}
self.settings.update_settings(not_defaults, self.suite)
@@ -97,7 +97,7 @@
_TestSettings.setUp(self)
self.project_settings =
os.path.join(os.path.dirname(defaultsettings.__file__),
'projectsettings.py')
-
+
def test_partial_project_settings_are_read(self):
self._set_to_projectsettings("default_message = 'new value'")
self.settings = Settings(self.path)
@@ -110,23 +110,23 @@
self.settings = Settings(self.path)
for name in names:
self.assertEquals(self.settings[name], 'new')
-
+
def _set_to_projectsettings(self, content):
f = open(self.project_settings, 'w')
f.write(content)
f.close()
-
+
def tearDown(self):
if os.path.exists(self.project_settings):
os.remove(self.project_settings)
_TestSettings.tearDown(self)
-
+
class Suite:
-
+
def __init__(self):
self.called = []
-
+
def update_default_message(self, orig, changed):
self.called.append((orig, changed))
=======================================
--- /trunk/utest/test_settings_utils.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_settings_utils.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,9 +20,9 @@
class TestSettingsIO(unittest.TestCase):
-
+
def setUp(self):
- self.settings_file =
os.path.join(os.path.dirname(__file__), 'data',
+ self.settings_file =
os.path.join(os.path.dirname(__file__), 'data',
'testsettings.py')
self.settings = SettingsIO(path=self.settings_file)
@@ -40,9 +40,9 @@
def test_no_settings_exists(self):
self.assertEquals(self.settings.read(), {})
-
+
def test_invalid_setting_name(self):
- self.assertRaises(InvalidSettings, self.settings.write,
+ self.assertRaises(InvalidSettings, self.settings.write,
{'name with space':0})
def test_settings_does_not_exist_anymore(self):
@@ -57,7 +57,7 @@
self.assertRaises(InvalidSettings, self.settings.read)
def test_setting_name_with_spaces(self):
- self.assertRaises(InvalidSettings, self._test_settings_io,
+ self.assertRaises(InvalidSettings, self._test_settings_io,
{'setting name spaces': 'value'})
def test_writing_string_setting(self):
@@ -67,7 +67,7 @@
self._test_settings_io({'unicode_string':u'non-ascii character
\xe4'})
def test_writing_list_setting(self):
- self._test_settings_io({'unicode_string': [1, 'string',
+ self._test_settings_io({'unicode_string': [1, 'string',
u'non-ascii character
\xe4']})
def test_writing_dictionary_setting(self):
@@ -92,10 +92,10 @@
with non-ascii chars \xe4
and quotes "foo" 'bar'
and even triple quotes \"\"\" '''
-"""
- self._test_settings_io({'multiline': multiline, 'string': u'some',
+"""
+ self._test_settings_io({'multiline': multiline, 'string': u'some',
'bool': False, 'int':1, 'float':2.4})
-
+
def test_updating_setting(self):
self._test_settings_io({'string': u'some', 'bool': False, 'int':1})
self.settings.write({'string': u'new', 'bool': True, 'int':1})
@@ -108,27 +108,27 @@
class Logger:
-
+
def __init__(self):
self.logs = []
-
+
def log(self, message):
self.logs.append(message)
class TestRFSettings(unittest.TestCase):
-
+
def setUp(self):
self.logger = Logger()
- self.settings_file =
os.path.join(os.path.dirname(__file__), 'data',
+ self.settings_file =
os.path.join(os.path.dirname(__file__), 'data',
'testsettings.py')
def tearDown(self):
self.settings.remove()
-
+
def test_default_values_are_read_correctly_when_no_user_settings(self):
defaults = {'foo':'bar'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
self.assertEquals(self.settings._settings, defaults)
@@ -136,7 +136,7 @@
def test_default_values_are_read_correctly_when_invalid_settings(self):
defaults = {'foo':'bar'}
self._add_invalid_data_to_user_settings_file('invalid syntax =')
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults,
logger=self.logger.log)
self.assertEquals(self.settings._settings, defaults)
log_end = "testsettings.py' is not a valid Python file.\ninvalid
syntax (testsettings.py, line 1)"
@@ -153,13 +153,13 @@
defaults = {'foo':'bar', 'hello':'world'}
self._write_settings({'foo':'new value'})
expected = {'foo':'new value', 'hello':'world'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
self.assertEquals(self.settings._settings, expected)
def test_changing_settings_with_setitem(self):
defaults = {'foo':'bar', 'hello':'world'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
self.settings['foo'] = 'new value'
expected = {'foo':'new value', 'hello':'world'}
@@ -167,23 +167,23 @@
def test_getting_settings_with_getitem(self):
defaults = {'foo':'bar', 'hello':'world'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
self.assertEquals('bar', self.settings['foo'])
def test_updating_settings_with_dict(self):
defaults = {'foo':'bar', 'hello':'world'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
self.assertEquals(self.settings._settings, defaults)
self.settings.update({'foo':'new value'})
expected = {'foo':'new value', 'hello':'world'}
self.assertEquals(self.settings._settings, expected)
self.assertEquals(self._read_settings(), expected)
-
+
def test_updating_settings_with_module(self):
defaults = {'foo':'bar', 'hello':'world'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
self._write_settings({'foo':'new value'})
expected = {'foo':'new value', 'hello':'world'}
@@ -194,9 +194,9 @@
def test_updating_settings_with_module_and_not_saving(self):
defaults = {'foo':'bar', 'hello':'world'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
-
+
self._write_settings({'foo':'new value'})
expected = {'foo':'new value', 'hello':'world'}
self.assertEquals(self.settings._settings, defaults)
@@ -206,25 +206,25 @@
def test_updating_settings_with_none(self):
defaults = {'foo':'bar', 'hello':'world'}
- self.settings = RFSettings(path=self.settings_file,
+ self.settings = RFSettings(path=self.settings_file,
defaults=defaults)
self.settings.update(None)
self.assertEquals(self.settings._settings, defaults)
-
+
def test_saving(self):
self.settings = RFSettings(path=self.settings_file)
values = {'foo':'bar', 'hello':'world'}
self.settings._settings = values
self.settings.save()
self.assertEquals(values, self._read_settings())
-
+
def test_loading(self):
self.settings = RFSettings(path=self.settings_file)
values = {'foo':'bar', 'hello':'world'}
self._write_settings(values)
self.settings.load()
self.assertEquals(values, self.settings._settings)
-
+
def test_restoring(self):
self.settings = RFSettings(path=self.settings_file,
defaults={'a':1})
values = {'foo':'bar', 'hello':'world'}
@@ -234,7 +234,7 @@
self.settings.restore()
self.assertEquals({'a':1}, self.settings._settings)
self.assertEquals({'a':1}, self._read_settings())
-
+
def _write_settings(self, dict):
io = SettingsIO(path=self.settings_file)
io.write(dict)
=======================================
--- /trunk/utest/test_ui_tree.py Tue Jun 29 04:42:43 2010
+++ /trunk/utest/test_ui_tree.py Tue Jun 29 04:47:13 2010
@@ -1,11 +1,11 @@
# Copyright 2008 Nokia Siemens Networks Oyj
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,8 +35,8 @@
self.visible = visible
class MockSuite(_Mock):
-
- def __init__(self, name, mediumname=None, longname=None, visible=True,
+
+ def __init__(self, name, mediumname=None, longname=None, visible=True,
suites=[], tests=[]):
_Mock.__init__(self, name, mediumname, longname, visible)
for suite in suites:
@@ -45,10 +45,10 @@
for test in tests:
test.parent = self
self.tests = tests
-
+
class MockTest(_Mock):
-
- def __init__(self, name, mediumname=None, longname=None,
+
+ def __init__(self, name, mediumname=None, longname=None,
visible=True, keywords=[]):
_Mock.__init__(self, name, mediumname, longname, visible)
for kw in keywords:
@@ -56,13 +56,13 @@
self.keywords = keywords
class TestTreeSuite(unittest.TestCase):
-
-
+
+
def test_simple_suite_name(self):
suite = MockSuite('Suite')
tree_suite = tree.SuiteTreeItem(suite)
self.assertEquals(tree_suite.label, 'Suite')
-
+
def test_name_when_test_cases(self):
test1 = MockTest('Test1')
test2 = MockTest('Test2')
@@ -78,7 +78,7 @@
self.assertEquals(tree_suite.label, 'Suite1')
self.assertEquals(tree_suite.children[0].label, 'SubSuite1')
self.assertEquals(tree_suite.children[1].label, 'SubSuite2')
-
+
def
test_collapse_all_suites_with_one_sub_suite_with_one_test_leaf(self):
test1 = MockTest('Test1')
subsub1 = MockSuite('SubSubSuite1', tests=[test1])
@@ -113,13 +113,13 @@
self.assertEquals(tree_suite.children[0].label, 'SubSubSuite1')
self.assertEquals(len(tree_suite.children), 1)
self.assertEquals(len(tree_suite.children[0].children), 1)
-
+
def test_get_icon_names_with_file_suite(self):
test = MockTest('Test')
suite = MockSuite('Suite', tests=[test])
tree_suite = tree.SuiteTreeItem(suite)
self.assertEquals(tree_suite.GetIconName(), 'file_suite')
-
+
def test_get_icon_names_with_dir_suite(self):
subsuite = MockSuite('SubSuite')
suite = MockSuite('Suite', suites=[subsuite])