Пример #1
0
 def test_secs_to_timestr(self):
     for inp, compact, verbose in [
         (0.001, '1ms', '1 millisecond'),
         (0.002, '2ms', '2 milliseconds'),
         (0.9999, '1s', '1 second'),
         (1, '1s', '1 second'),
         (1.9999, '2s', '2 seconds'),
         (2, '2s', '2 seconds'),
         (60, '1min', '1 minute'),
         (120, '2min', '2 minutes'),
         (3600, '1h', '1 hour'),
         (7200, '2h', '2 hours'),
         (60*60*24, '1d', '1 day'),
         (60*60*48, '2d', '2 days'),
         (171967.667, '1d 23h 46min 7s 667ms',
          '1 day 23 hours 46 minutes 7 seconds 667 milliseconds'),
         (7320, '2h 2min', '2 hours 2 minutes'),
         (7210.05, '2h 10s 50ms', '2 hours 10 seconds 50 milliseconds') ,
         (11.1111111, '11s 111ms', '11 seconds 111 milliseconds'),
         (0.55555555, '556ms', '556 milliseconds'),
         (0, '0s', '0 seconds'),
         (9999.9999, '2h 46min 40s', '2 hours 46 minutes 40 seconds'),
         (10000, '2h 46min 40s', '2 hours 46 minutes 40 seconds'),
         (-1, '- 1s', '- 1 second'),
         (-171967.667, '- 1d 23h 46min 7s 667ms',
          '- 1 day 23 hours 46 minutes 7 seconds 667 milliseconds')]:
         assert_equal(secs_to_timestr(inp, compact=True), compact, inp)
         assert_equal(secs_to_timestr(inp), verbose, inp)
Пример #2
0
 def test_reset_suites(self):
     s1 = TestSuite(name='s1')
     self.suite.suites = [s1]
     s2 = self.suite.suites.create(name='s2')
     assert_true(s1.parent is self.suite)
     assert_true(s2.parent is self.suite)
     assert_equal(list(self.suite.suites), [s1, s2])
 def test_test_case_table(self):
     self._create_table('test cases', [['# start of table comment'],
                                       ['Test case'],
                                       ['', 'No operation', '# step comment'],
                                       ['', '', '#This step has', 'only comment'],
                                       ['Another test', '#comment in name row'],
                                       ['', 'Log many', 'argh'],
                                       ['#', 'Comment between step def'],
                                       ['', '...', 'urgh'],
                                       ['Test with for loop'],
                                       ['',':FOR', '${i}', 'IN', '1', '# FOR comment'],
                                       ['','...', '2', '3', '##continues', 'here'],
                                       ['#commented out in for loop'],
                                       ['', '#commented out in for loop, again'],
                                       ['','', 'Fooness in the bar', '###end commtne'],
                                       ['','# ', '   Barness  '],
                                       ['', 'Lodi']
                                       ])
     self._assert_comment(self._first_test().steps[0], ['# start of table comment'])
     self._assert_comment(self._first_test().steps[1], ['# step comment'])
     self._assert_comment(self._first_test().steps[2], ['#This step has', 'only comment'])
     self._assert_comment(self._nth_test(2).steps[0], ['#comment in name row'])
     self._assert_comment(self._nth_test(2).steps[1], ['#', 'Comment between step def'])
     assert_equal(self._nth_test(2).steps[1].args, ['argh', 'urgh'])
     self._assert_comment(self._nth_test(3).steps[0], ['# FOR comment', '##continues', 'here'])
     self._assert_comment(self._nth_test(3).steps[0].steps[0], ['#commented out in for loop'])
     self._assert_comment(self._nth_test(3).steps[0].steps[1], ['#commented out in for loop, again'])
     self._assert_comment(self._nth_test(3).steps[0].steps[2], ['###end commtne'])
     self._assert_comment(self._nth_test(3).steps[1], ['#', 'Barness'])
     self._number_of_steps_should_be(self._nth_test(3), 3)
Пример #4
0
 def test_elapsed_time_to_string_without_millis(self):
     for elapsed, expected in [(0, '00:00:00'),
                               (1, '00:00:00'),
                               (499, '00:00:00'),
                               (499.999, '00:00:00'),
                               (500, '00:00:01'),
                               (999, '00:00:01'),
                               (1000, '00:00:01'),
                               (1499, '00:00:01'),
                               (59499.9, '00:00:59'),
                               (59500.0, '00:01:00'),
                               (59999, '00:01:00'),
                               (60000, '00:01:00'),
                               (654321, '00:10:54'),
                               (654500, '00:10:55'),
                               (3599999, '01:00:00'),
                               (3600000, '01:00:00'),
                               (359999999, '100:00:00'),
                               (360000000, '100:00:00'),
                               (360000500, '100:00:01')]:
         assert_equal(elapsed_time_to_string(elapsed, include_millis=False),
                      expected, elapsed)
         if expected != '00:00:00':
             assert_equal(elapsed_time_to_string(-1 * elapsed, False),
                          '-' + expected, elapsed)
Пример #5
0
 def test_create_and_add_suite(self):
     s1 = self.suite.suites.create(name='s1')
     s2 = TestSuite(name='s2')
     self.suite.suites.append(s2)
     assert_true(s1.parent is self.suite)
     assert_true(s2.parent is self.suite)
     assert_equal(list(self.suite.suites), [s1, s2])
 def test_invalid_keyword_settings(self):
     self._create_table('Keywords', [['My User Keyword'],
                                     ['', '[ank ka]']])
     assert_equal(self._logger.value(), "Error in file 'None': "
                                         "Invalid syntax in keyword "
                                         "'My User Keyword': Non-existing "
                                         "setting 'ank ka'.")
 def test_with_empty_body(self):
     self._create_table('Test cases', [['For loop test'],
                                       ['', ':FOR ', '${var}', 'IN', 'foo'],
                                       ['', 'Log', 'outside FOR']])
     test = self._first_test()
     assert_equal(len(test.steps), 2)
     assert_equal(test.steps[0].steps, [])
 def _try_testcasefile_settings_with_postfix(self, postfix):
     doc = 'This is doc'
     template = 'Foo'
     more_doc = 'smore'
     force_tags = 'force'
     more_tags = 'more tagness'
     even_more_tags = 'even more'
     default_tags = 'default'
     name, args = 'Keyword Name', ('a1', 'a2')
     table = [('Documentation', doc),
              ('...', more_doc),
              ('S  uite Tear Down', name),
              ('...',) + args,
              ('S  uite SeTUp', name) + args,
              ('force tags', force_tags),
              ('...', more_tags),
              ('De Fault TAGS', default_tags),
              ('...', more_tags, even_more_tags),
              ('test timeout', '1s'),
              ('...', 'timeout message'),
              ('...', more_doc),
              ('test template', template)]
     table = list(self._postfix_settings(table, postfix))
     self._create_table('Settings', table)
     self._assert_setting('doc', doc + '\\n' + more_doc)
     self._assert_fixture('suite_setup', name, list(args))
     self._assert_fixture('suite_teardown', name, list(args))
     self._assert_tags('default_tags', [default_tags, more_tags, even_more_tags])
     self._assert_tags('force_tags', [force_tags, more_tags])
     timeout = self._setting_with('test_timeout')
     assert_equal(timeout.value, '1s')
     assert_equal(timeout.message, 'timeout message '+more_doc)
     self._assert_setting('test_template', template)
 def test_invalid_test_settings(self):
     self._create_table('Test cases', [['My test name'],
                                       ['', '[Aasi]']])
     assert_equal(self._logger.value(), "Error in file 'None': "
                                         "Invalid syntax in test case "
                                         "'My test name': Non-existing "
                                         "setting 'Aasi'.")
 def test_criticality(self):
     for c in range(10):
         crit = ['c%s' % (i+1) for i in range(c)]
         for n in range(10):
             nonc = ['n%s' % (i+1) for i in range(n)]
             builder = TagStatisticsBuilder(Criticality(crit, nonc))
             assert_equal([s.name for s in builder.stats], crit + nonc),
Пример #11
0
 def test_negative(self):
     for number in range(1000):
         number *= -1
         for extra in range(5):
             extra /= 10.0
             assert_equal(roundup(number + extra), number)
             assert_equal(roundup(number - extra), number)
 def test_valid_string_containing_patterns_is_parsed_correctly(self):
     for arg, exp_pattern in [('*', '^(.*)$'), ('f*r', '^f(.*)r$'),
                              ('*a*', '^(.*)a(.*)$'),  ('?', '^(.)$'),
                              ('??', '^(..)$'), ('f???ar', '^f(...)ar$'),
                              ('F*B?R*?', '^F(.*)B(.)R(.*)(.)$')]:
         link = TagStatLink(arg, 'some_url', 'some_title')
         assert_equal(exp_pattern, link._regexp.pattern)
 def test_get_link_returns_correct_link_when_matches(self):
     for arg, exp in [(('smoke', 'http://tobacco.com', 'Lung_cancer'),
                       ('http://tobacco.com', 'Lung cancer')),
                      (('tag', 'ftp://foo:809/bar.zap', 'Foo_in a Bar'),
                       ('ftp://foo:809/bar.zap', 'Foo in a Bar'))]:
         link = TagStatLink(*arg)
         assert_equal(exp, link.get_link(arg[0]))
 def test_combine(self):
     # This is more like an acceptance test than a unit test ...
     for comb_tags, tests_tags, crit_tags in [
             (['t1&t2'], [['t1','t2','t3'],['t1','t3']], []),
             (['1&2&3'], [['1','2','3'],['1','2','3','4']], ['1','2']),
             (['1&2','1&3'], [['1','2','3'],['1','3'],['1']], ['1']),
             (['t*'], [['t1','x','y'],['tee','z'],['t']], ['x']),
             (['t?&s'], [['t1','s'],['tt','s','u'],['tee','s'],['s']], []),
             (['t*&s','*'], [['s','t','u'],['tee','s'],[],['x']], []),
             (['tNOTs'], [['t','u'],['t','s']], []),
             (['tNOTs','t&s','tNOTsNOTu', 't&sNOTu'],
               [['t','u'],['t','s'],['s','t','u'],['t'],['t','v']], ['t']),
             (['nonex'], [['t1'],['t1,t2'],[]], [])
             ]:
         # 1) Create tag stats
         builder = TagStatisticsBuilder(Criticality(crit_tags),
                                        combined=[(t, '') for t in comb_tags])
         all_tags = []
         for tags in tests_tags:
             builder.add_test(TestCase(status='PASS', tags=tags),)
             all_tags.extend(tags)
         # 2) Actual values
         names = [stat.name for stat in builder.stats]
         # 3) Expected values
         exp_crit = []; exp_noncr = []
         for tag in Tags(all_tags):
             if tag in crit_tags:
                 exp_crit.append(tag)
             else:
                 exp_noncr.append(tag)
         exp_names = exp_crit + sorted(comb_tags) + exp_noncr
         # 4) Verify names (match counts were already verified)
         assert_equal(names, exp_names)
 def test_exclude(self):
     for excl, tags in self._incl_excl_data:
         builder = TagStatisticsBuilder(excluded=excl)
         builder.add_test(TestCase(status='PASS', tags=tags))
         matcher = MultiMatcher(excl)
         expected = [tag for tag in tags if not matcher.match(tag)]
         assert_equal([s.name for s in builder.stats], sorted(expected))
 def test_combine_with_same_name_as_existing_tag(self):
     builder = TagStatisticsBuilder(combined=[('x*', 'name')])
     builder.add_test(TestCase(tags=['name', 'another']))
     assert_equal([(s.name, s.combined) for s in builder.stats],
                   [('name', 'x*'),
                    ('another', None),
                    ('name', None)])
 def test_tags_equal_to_critical_or_non_critical_pattern_are_not_removed(self):
     builder = TagStatisticsBuilder(Criticality('sORry'))
     builder.add_test(TestCase(tags=['sorry']))
     builder.add_test(TestCase(tags=['s OR ry']))
     assert_equal([(s.name, s.info, s.total) for s in builder.stats],
                  [('s OR ry', 'critical', 0),
                   ('sorry', '', 2)])
Пример #18
0
 def test_include(self):
     for incl, tags in self._incl_excl_data:
         builder = TagStatisticsBuilder(Criticality(), incl, [])
         builder.add_test(TestCase(status='PASS', tags=tags))
         matcher = MultiMatcher(incl, match_if_no_patterns=True)
         expected = [tag for tag in tags if matcher.match(tag)]
         assert_equal([s.name for s in builder.stats], sorted(expected))
 def test_timestamp_given_as_integer(self):
     now = int(time.time())
     splitter = Splitter("*INFO:xxx* No timestamp\n" "*INFO:0* Epoch\n" "*HTML:%d*X" % (now * 1000))
     self._verify_message(splitter, "*INFO:xxx* No timestamp")
     self._verify_message(splitter, "Epoch", timestamp=0, index=1)
     self._verify_message(splitter, html=True, timestamp=now, index=2)
     assert_equal(len(list(splitter)), 3)
Пример #20
0
 def test_other_list_like_items_are_not_touched(self):
     value = ({'key': 'value'}, [{}])
     d = DotDict(key=value)
     assert_equal(d.key[0]['key'], 'value')
     assert_false(hasattr(d.key[0], 'key'))
     assert_true(isinstance(d.key[0], dict))
     assert_true(isinstance(d.key[1][0], dict))
Пример #21
0
 def test_del(self):
     del self.dd.x
     del self.dd[2]
     self.dd.pop('z')
     assert_equal(self.dd, {})
     assert_raises(KeyError, self.dd.__delitem__, 'nonex')
     assert_raises(AttributeError, self.dd.__delattr__, 'nonex')
 def test_insert(self):
     items = ItemList(str)
     items.insert(0, 'a')
     items.insert(0, 'b')
     items.insert(3, 'c')
     items.insert(1, 'd')
     assert_equal(list(items), ['b', 'd', 'a', 'c'])
 def _verify_warning(self, msg, signame, err):
     ctrlc = 'or with Ctrl-C ' if signame == 'INT' else ''
     assert_equal(msg.message,
                  'Registering signal %s failed. Stopping execution '
                  'gracefully with this signal %sis not possible. '
                  'Original error was: %s' % (signame, ctrlc, err))
     assert_equal(msg.level, 'WARN')
Пример #24
0
 def test_set(self):
     value = ['value']
     for var in SCALARS + LISTS:
         self.varz[var] = value
         assert_equal(self.varz[var], value)
         assert_equal(self.varz[var.lower().replace(' ', '')] , value)
         self.varz.clear()
Пример #25
0
 def test_set_list(self):
     for var in LISTS:
         for value in [[], [''], ['str'], [10], ['hi', 'u'], ['hi', 2],
                       [{'a': 1, 'b': 2}, self, None]]:
             self.varz[var] = value
             assert_equal(self.varz[var], value)
             self.varz.clear()
 def test_counting_column_widths(self):
     table = TestCaseTable(None)
     table.set_header(['test cases', 'col header', 'short'])
     assert_equal(ColumnAligner(18, table)._widths, [18, 10, 5])
     test = table.add('A test')
     test.add_step(['Some kw', 'a longer arg', 'another']    )
     assert_equal(ColumnAligner(18, table)._widths, [18, 10, 12, 7])
Пример #27
0
 def test_variable_as_object(self):
     obj = PythonObject('a', 1)
     self.varz['${obj}'] = obj
     assert_equal(self.varz['${obj}'], obj)
     expected = ['Some text here %s and %s there' % (obj, obj)]
     actual = self.varz.replace_list(['Some text here ${obj} and ${obj} there'])
     assert_equal(actual, expected)
 def _verify_reg(self, lib_name, keyword, keyword_name, arg_count,
                 given_count=None):
     if PY3 and given_count is None:
         return
     self.register_run_keyword(lib_name, keyword, given_count)
     assert_equal(self.reg.get_args_to_process(lib_name, keyword_name),
                  arg_count)
 def test_names_on_first_content_row(self):
     table = TestCaseTable(None)
     t = table.add('Test')
     t.add_step(['No op'])
     extractor = DataExtractor(lambda t,n: True)
     assert_equal(list(extractor._rows_from_indented_table(table)),
                   [['Test', 'No op']])
Пример #30
0
 def test_creating_duplicate_keyword_in_resource_file(self):
     lib = self._get_userlibrary('kw', 'kw', 'kw 2')
     assert_equal(len(lib.handlers), 2)
     assert_true('kw' in lib.handlers)
     assert_true('kw 2' in lib.handlers)
     assert_equal(lib.handlers['kw'].error,
                   "Keyword with same name defined multiple times.")
Пример #31
0
 def test_replace_escaped(self):
     self.varz['${foo}'] = 'bar'
     for inp, exp in [(r'\${foo}', r'${foo}'), (r'\\${foo}', r'\bar'),
                      (r'\\\${foo}', r'\${foo}'), (r'\\\\${foo}', r'\\bar'),
                      (r'\\\\\${foo}', r'\\${foo}')]:
         assert_equal(self.varz.replace_scalar(inp), exp)
Пример #32
0
 def test_copy(self):
     varz = Variables()
     varz['${foo}'] = 'bar'
     copy = varz.copy()
     assert_equal(copy['${foo}'], 'bar')
Пример #33
0
 def test_list_variable_as_scalar(self):
     self.varz['@{name}'] = exp = ['spam', 'eggs']
     assert_equal(self.varz.replace_scalar('${name}'), exp)
     assert_equal(self.varz.replace_list(['${name}', 42]), [exp, 42])
     assert_equal(self.varz.replace_string('${name}'), str(exp))
Пример #34
0
 def test_math_with_internal_vars_with_spaces(self):
     assert_equal(self.varz.replace_scalar('${${1} + ${2.5}}'), 3.5)
     assert_equal(self.varz.replace_scalar('${${1} - ${2} + 1}'), 0)
     assert_equal(self.varz.replace_scalar('${${1} * ${2} - 1}'), 1)
     assert_equal(self.varz.replace_scalar('${${1} / ${2.0}}'), 0.5)
Пример #35
0
 def test_math_with_internal_vars(self):
     assert_equal(self.varz.replace_scalar('${${1}+${2}}'), 3)
     assert_equal(self.varz.replace_scalar('${${1}-${2}}'), -1)
     assert_equal(self.varz.replace_scalar('${${1}*${2}}'), 2)
     assert_equal(self.varz.replace_scalar('${${1}//${2}}'), 0)
Пример #36
0
 def test_escaping_with_extended_variable_syntax(self):
     self.varz['${p}'] = 'c:\\temp'
     assert self.varz['${p}'] == 'c:\\temp'
     assert_equal(self.varz.replace_scalar('${p + "\\\\foo.txt"}'),
                  'c:\\temp\\foo.txt')
Пример #37
0
 def test_extended_variables(self):
     # Extended variables are vars like ${obj.name} when we have var ${obj}
     obj = PythonObject('a', [1, 2, 3])
     dic = {'a': 1, 'o': obj}
     self.varz['${obj}'] = obj
     self.varz['${dic}'] = dic
     assert_equal(self.varz.replace_scalar('${obj.a}'), 'a')
     assert_equal(self.varz.replace_scalar('${obj.b}'), [1, 2, 3])
     assert_equal(self.varz.replace_scalar('${obj.b[0]}-${obj.b[1]}'),
                  '1-2')
     assert_equal(self.varz.replace_scalar('${dic["a"]}'), 1)
     assert_equal(self.varz.replace_scalar('${dic["o"]}'), obj)
     assert_equal(self.varz.replace_scalar('-${dic["o"].b[2]}-'), '-3-')
Пример #38
0
 def test_replace_non_strings(self):
     self.varz['${d}'] = {'a': 1, 'b': 2}
     self.varz['${n}'] = None
     assert_equal(self.varz.replace_scalar('${d}'), {'a': 1, 'b': 2})
     assert_equal(self.varz.replace_scalar('${n}'), None)
Пример #39
0
 def test_replace_list_item(self):
     self.varz['@{L}'] = ['v0', 'v1']
     assert_equal(self.varz.replace_list(['@{L}[0]']), ['v0'])
     assert_equal(self.varz.replace_scalar('@{L}[1]'), 'v1')
     assert_equal(self.varz.replace_scalar('-@{L}[0]@{L}[1]@{L}[0]-'),
                  '-v0v1v0-')
     self.varz['@{L2}'] = ['v0', ['v11', 'v12']]
     assert_equal(self.varz.replace_list(['@{L2}[0]']), ['v0'])
     assert_equal(self.varz.replace_list(['@{L2}[1]']), [['v11', 'v12']])
     assert_equal(self.varz.replace_scalar('@{L2}[0]'), 'v0')
     assert_equal(self.varz.replace_scalar('@{L2}[1]'), ['v11', 'v12'])
     assert_equal(self.varz.replace_list(['@{L}[0]', '@{L2}[1]']),
                  ['v0', ['v11', 'v12']])
Пример #40
0
 def test_non_string_input(self):
     for item in [1, False, None, [], (), {}, object]:
         assert_equal(self.varz.replace_list([item]), [item])
         assert_equal(self.varz.replace_scalar(item), item)
         assert_equal(self.varz.replace_string(item), str(item))
Пример #41
0
 def test_exclude(self):
     self.suite.visit(SuiteConfigurer(exclude_tags=['t1', '?1ANDt2']))
     assert_equal([t.name for t in self.suite.tests], ['n0'])
     assert_equal(list(self.suite.suites), [])
Пример #42
0
 def test_replace_dict_item(self):
     self.varz['&{D}'] = {'a': 1, 2: 'b'}
     assert_equal(self.varz.replace_list(['&{D}[a]']), [1])
     assert_equal(self.varz.replace_scalar('&{D}[${2}]'), 'b')
Пример #43
0
 def test_remove_negative_tags_using_pattern(self):
     self.suite.visit(SuiteConfigurer(set_tags=['-t*', '-nomatch']))
     assert_equal(list(self.suite.tests[0].tags), [])
     assert_equal(list(self.suite.suites[0].tests[0].tags), [])
Пример #44
0
 def test_include_by_names(self):
     self.suite.visit(
         SuiteConfigurer(include_suites=['s?b', 'xxx'],
                         include_tests=['', '*1', 'xxx']))
     assert_equal(list(self.suite.tests), [])
     assert_equal([t.name for t in self.suite.suites[0].tests], ['n1'])
Пример #45
0
 def test_tags_are_normalized(self):
     self.suite.visit(
         SuiteConfigurer(set_tags=['TAG', '', 't a g', 'NONE']))
     assert_equal(list(self.suite.tests[0].tags), ['TAG'])
     assert_equal(list(self.suite.suites[0].tests[0].tags), ['tag'])
Пример #46
0
 def test_include(self):
     self.suite.visit(
         SuiteConfigurer(include_tags=['t1', 'none', '', '?2']))
     assert_equal([t.name for t in self.suite.tests], ['n1', 'n2'])
     assert_equal([t.name for t in self.suite.suites[0].tests], ['n1'])
Пример #47
0
 def test_metadata_is_normalized(self):
     self.suite.visit(SuiteConfigurer(metadata={'aa': '2', 'B_B': '2'}))
     assert_equal(self.suite.metadata, {'A A': '2', 'bb': '2'})
Пример #48
0
 def test_remove_negative_tags(self):
     self.suite.visit(SuiteConfigurer(set_tags=['n', '-TAG']))
     assert_equal(list(self.suite.tests[0].tags), ['n'])
     assert_equal(list(self.suite.suites[0].tests[0].tags), ['n'])
Пример #49
0
 def test_metadata(self):
     self.suite.visit(SuiteConfigurer(metadata={'bb': '2', 'C': '2'}))
     assert_equal(self.suite.metadata, {'A A': '1', 'bb': '2', 'C': '2'})
Пример #50
0
 def test_set_tags(self):
     self.suite.visit(SuiteConfigurer(set_tags=['new']))
     assert_equal(list(self.suite.tests[0].tags), ['new'])
     assert_equal(list(self.suite.suites[0].tests[0].tags), ['new', 'tag'])
Пример #51
0
 def test_name_and_doc(self):
     self.suite.visit(SuiteConfigurer(name='New Name', doc='New Doc'))
     assert_equal(self.suite.name, 'New Name')
     assert_equal(self.suite.doc, 'New Doc')
Пример #52
0
 def _should_contain_no_messages_or_keywords(self, keyword):
     assert_equal(len(keyword.messages), 0)
     assert_equal(len(keyword.body), 0)
Пример #53
0
 def test_remove_passed_does_not_remove_when_test_contains_warning(self):
     suite = TestSuite()
     test = self._test_with_warning(suite)
     self._remove_passed(suite)
     assert_equal(len(test.body[0].body), 1)
     assert_equal(len(test.body[1].messages), 1)
Пример #54
0
 def test_remove_for_removes_passing_items_when_there_are_failures(self):
     suite, forloop = self.suite_with_forloop()
     failed = forloop.body.create_keyword(status='FAIL')
     self._remove_for_loop(suite)
     assert_equal(len(forloop.body), 1)
     assert_true(forloop.body[-1] is failed)
Пример #55
0
 def test_tags(self):
     assert_equal(list(self.statistics.tags), [])
Пример #56
0
 def test_remove_for_removes_passed_items_except_last(self):
     suite, forloop = self.suite_with_forloop()
     last = forloop.body[-1]
     self._remove_for_loop(suite)
     assert_equal(len(forloop.body), 1)
     assert_true(forloop.body[-1] is last)
Пример #57
0
 def test_total_stats(self):
     assert_equal(self.stats.total._stat.elapsed, 11001)
Пример #58
0
def verify_stat(stat, name, passed, failed, skipped,
                combined=None, id=None, elapsed=0):
    assert_equal(stat.name, name, 'stat.name')
    assert_equal(stat.passed, passed)
    assert_equal(stat.failed, failed)
    assert_equal(stat.skipped, skipped)
    assert_equal(stat.total, passed + failed + skipped)
    if hasattr(stat, 'combined'):
        assert_equal(stat.combined, combined)
    if hasattr(stat, 'id'):
        assert_equal(stat.id, id)
    assert_equal(stat.elapsed, elapsed)
Пример #59
0
 def test_only_root_level(self):
     suite = Statistics(generate_suite(), suite_stat_level=1).suite
     verify_suite(suite, 'Root Suite', 's1', 4, 3, 2)
     assert_equal(len(suite.suites), 0)
Пример #60
0
 def test_suite_stats(self):
     assert_equal(self.stats.suite.stat.elapsed, 59999)
     assert_equal(self.stats.suite.suites[0].stat.elapsed, 30000)
     assert_equal(self.stats.suite.suites[1].stat.elapsed, 12042)