-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathmutmut_config.py
More file actions
31 lines (23 loc) · 857 Bytes
/
mutmut_config.py
File metadata and controls
31 lines (23 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
def init():
pass
def pre_mutation(context, **_):
if (
'@functools.wraps' in context.current_source_line
or '@dispatch' in context.current_source_line
or '@abstractmethod' in context.current_source_line
or '@reinvokable' in context.current_source_line
):
context.skip = True
return
if '__tests.py' in context.filename:
context.skip = True
# run only relevant test module
base_path = context.filename[: -len('.py')]
base_name = os.path.split(base_path)[-1]
module_test_file = f'{base_path}__tests.py'
doc_test_file = f'docs/test_doc_{base_name}.py'
if os.path.exists(module_test_file):
context.config.test_command += ' ' + module_test_file
if os.path.exists(doc_test_file):
context.config.test_command += ' ' + doc_test_file