Dynamically build test methods for each copyright file in `test_dir` and attach the test method to the `clazz` class.
(test_dir, clazz, prefix='test_', regen=REGEN_TEST_FIXTURES)
| 155 | |
| 156 | |
| 157 | def build_tests(test_dir, clazz, prefix='test_', regen=REGEN_TEST_FIXTURES): |
| 158 | ''' |
| 159 | Dynamically build test methods for each copyright file in `test_dir` and |
| 160 | attach the test method to the `clazz` class. |
| 161 | ''' |
| 162 | test_data_dir = path.join(path.dirname(__file__), 'data') |
| 163 | test_dir_loc = path.join(test_data_dir, test_dir) |
| 164 | # loop through all items and attach a test method to our test class |
| 165 | for test_file in relative_walk(test_dir_loc): |
| 166 | test_loc = path.join(test_dir_loc, test_file) |
| 167 | |
| 168 | test_name2 = prefix + 'detailed_' + text.python_safe_name(test_file) |
| 169 | test_method = create_test_function( |
| 170 | test_loc=test_loc, |
| 171 | expected_loc=test_loc + '-detailed.expected.yml', |
| 172 | test_name=test_name2, |
| 173 | regen=regen, |
| 174 | simplified=False, |
| 175 | ) |
| 176 | # attach that method to the class |
| 177 | setattr(clazz, test_name2, test_method) |
| 178 | |
| 179 | |
| 180 | class TestDebianCopyrightLicenseDetection(FileBasedTesting): |
no test coverage detected