Builds a list of directories to ignore Return: a list ['--ignore', 'dir1', '--ignore', 'dir2', etc...] Because we have several non-test directories and files in our tests/ path, pytest can have auto-discovery problems -- i.e., pytest may try to execute some non-test code as though it
(valid_dirs)
| 220 | |
| 221 | |
| 222 | def build_ignore_dir_arg_list(valid_dirs): |
| 223 | """ Builds a list of directories to ignore |
| 224 | |
| 225 | Return: |
| 226 | a list ['--ignore', 'dir1', '--ignore', 'dir2', etc...] |
| 227 | |
| 228 | Because we have several non-test directories and files in our tests/ path, pytest |
| 229 | can have auto-discovery problems -- i.e., pytest may try to execute some non-test |
| 230 | code as though it contained tests, resulting in misleading warnings or failures. |
| 231 | (There is a JIRA filed to restructure this: IMPALA-4417.) |
| 232 | """ |
| 233 | subdirs = [subdir for subdir in os.listdir(TEST_DIR) |
| 234 | if os.path.isdir(subdir) and not subdir.startswith(".")] |
| 235 | for subdir in subdirs: |
| 236 | assert subdir in VALID_TEST_DIRS or subdir in TEST_HELPER_DIRS,\ |
| 237 | "Unexpected test dir '%s' is not in the list of valid or helper test dirs"\ |
| 238 | % subdir |
| 239 | ignored_dir_list = [] |
| 240 | for subdir in (set(subdirs) - set(valid_dirs)): |
| 241 | ignored_dir_list += ['--ignore', subdir] |
| 242 | return ignored_dir_list |
| 243 | |
| 244 | |
| 245 | def print_metrics(substring): |