def _validate_single_test(test, results): param_names = {p.id: p.name for p in _find_all_parameters(test)} for param_values in _iter_param_value_sets(test): is_excluded = any( (param_names[param_id], value) in test.excluded_param_values for param_id, value in param_values.items()) for repetition in xrange(test.get_num_expected_repetitions()): # pylint: disable=unused-variable for index, result in enumerate(results): if _result_matches(result, param_values): results.pop(index) if is_excluded: assert result.is_skip() else: _validate_single_test_result(test, result) break else: assert False, 'Could not find parameter set {}'.format( param_values) assert not results, 'Unmatched results exist'
def _validate_single_test(test, results): for param_values in _iter_param_value_sets(test): for repetition in xrange(test.get_num_expected_repetitions()): for index, result in enumerate(results): if _result_matches(test, result, param_values): results.pop(index) _validate_single_test_result(test, result) break else: assert False, "Could not find parameter set {0}".format(param_values) assert not results, "Unmatched results exist"
def _validate_single_test(test, results): for param_values in _iter_param_value_sets(test): for repetition in xrange(test.get_num_expected_repetitions()): for index, result in enumerate(results): if _result_matches(test, result, param_values): results.pop(index) _validate_single_test_result(test, result) break else: assert False, 'Could not find parameter set {0}'.format( param_values) assert not results, 'Unmatched results exist'
def generate_tests(self, num_tests=3): return [self.generate_test() for _ in xrange(num_tests)]
def test_fixtures_representation_strings(results, a_values, fixture_values, filename, is_class): prefix = '{0}:'.format(filename) if is_class: prefix += 'Test.' assert len(results) == len(a_values) * len(fixture_values) assert set(result.test_metadata.address for result in results) == set( '{0}test_1(a={1}, fixture=fixture{2})'.format(prefix, i, j) for i, j in itertools.product(a_values, xrange(len(fixture_values))))
def test_fixtures_representation_strings(results, a_values, fixture_values, filename, is_class): prefix = '{0}:'.format(filename) if is_class: prefix += 'Test.' assert len(results) == len(a_values) * len(fixture_values) assert set(result.test_metadata.address for result in results) == set( '{0}test_1(a={1},fixture=fixture{2})'.format(prefix, i, j) for i, j in itertools.product(a_values, xrange(len(fixture_values))))