| OLD | NEW |
| 1 # Copyright 2014 Dirk Pranke. All rights reserved. | 1 # Copyright 2014 Dirk Pranke. All rights reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 maxDiff = 2048 | 63 maxDiff = 2048 |
| 64 | 64 |
| 65 def test_basic(self): | 65 def test_basic(self): |
| 66 test_names = ['foo_test.FooTest.test_fail', | 66 test_names = ['foo_test.FooTest.test_fail', |
| 67 'foo_test.FooTest.test_pass', | 67 'foo_test.FooTest.test_pass', |
| 68 'foo_test.FooTest.test_skip'] | 68 'foo_test.FooTest.test_skip'] |
| 69 | 69 |
| 70 result_set = json_results.ResultSet() | 70 result_set = json_results.ResultSet() |
| 71 result_set.add( | 71 result_set.add( |
| 72 json_results.Result('foo_test.FooTest.test_fail', | 72 json_results.Result('foo_test.FooTest.test_fail', |
| 73 json_results.ResultType.Failure, 0, 0, 0, | 73 json_results.ResultType.Failure, 0, 0.1, 0, |
| 74 unexpected=True)) | 74 unexpected=True)) |
| 75 result_set.add(json_results.Result('foo_test.FooTest.test_pass', | 75 result_set.add(json_results.Result('foo_test.FooTest.test_pass', |
| 76 json_results.ResultType.Pass, | 76 json_results.ResultType.Pass, |
| 77 0, 0, 0)) | 77 0, 0.2, 0)) |
| 78 result_set.add(json_results.Result('foo_test.FooTest.test_skip', | 78 result_set.add(json_results.Result('foo_test.FooTest.test_skip', |
| 79 json_results.ResultType.Skip, | 79 json_results.ResultType.Skip, |
| 80 0, 0, 0, unexpected=False)) | 80 0, 0.3, 0, unexpected=False)) |
| 81 | 81 |
| 82 full_results = json_results.make_full_results( | 82 full_results = json_results.make_full_results( |
| 83 ['foo=bar'], 0, test_names, result_set) | 83 ['foo=bar'], 0, test_names, result_set) |
| 84 expected_full_results = { | 84 expected_full_results = { |
| 85 'foo': 'bar', | 85 'foo': 'bar', |
| 86 'interrupted': False, | 86 'interrupted': False, |
| 87 'num_failures_by_type': { | 87 'num_failures_by_type': { |
| 88 'FAIL': 1, | 88 'FAIL': 1, |
| 89 'PASS': 1, | 89 'PASS': 1, |
| 90 'SKIP': 1}, | 90 'SKIP': 1}, |
| 91 'path_delimiter': '.', | 91 'path_delimiter': '.', |
| 92 'seconds_since_epoch': 0, | 92 'seconds_since_epoch': 0, |
| 93 'tests': { | 93 'tests': { |
| 94 'foo_test': { | 94 'foo_test': { |
| 95 'FooTest': { | 95 'FooTest': { |
| 96 'test_fail': { | 96 'test_fail': { |
| 97 'expected': 'PASS', | 97 'expected': 'PASS', |
| 98 'actual': 'FAIL', | 98 'actual': 'FAIL', |
| 99 'is_unexpected': True}, | 99 'times': [0.1], |
| 100 'is_unexpected': True, |
| 101 }, |
| 100 'test_pass': { | 102 'test_pass': { |
| 101 'expected': 'PASS', | 103 'expected': 'PASS', |
| 102 'actual': 'PASS'}, | 104 'actual': 'PASS', |
| 105 'times': [0.2], |
| 106 }, |
| 103 'test_skip': { | 107 'test_skip': { |
| 104 'expected': 'SKIP', | 108 'expected': 'SKIP', |
| 105 'actual': 'SKIP'}}}}, | 109 'actual': 'SKIP', |
| 110 'times': [0.3], |
| 111 }}}}, |
| 106 'version': 3} | 112 'version': 3} |
| 107 self.assertEqual(full_results, expected_full_results) | 113 self.assertEqual(full_results, expected_full_results) |
| OLD | NEW |