Skip to content

Commit 7c01623

Browse files
committed
Raised timeout value a lot and fixed calculation
1 parent 8fc5bb7 commit 7c01623

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

mutmut/__main__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
34: 'skipped',
8585
35: 'suspicious',
8686
36: 'timeout',
87+
24: 'timeout', # SIGXCPU
8788
152: 'timeout', # SIGXCPU
8889
}
8990

@@ -687,10 +688,12 @@ def execute_pytest(self, params, **kwargs):
687688
import pytest
688689
if mutmut.config.debug:
689690
params = ['-vv'] + params
690-
print('pytest: ', params, kwargs)
691+
print('python -m pytest ', ' '.join(params))
691692
exit_code = int(pytest.main(params, **kwargs))
692693
if exit_code == 4:
693694
raise BadTestExecutionCommandsException(params)
695+
if mutmut.config.debug:
696+
print(' exit code', exit_code)
694697
return exit_code
695698

696699
def run_stats(self, *, tests):
@@ -713,7 +716,7 @@ def pytest_runtest_makereport(self, item, call):
713716

714717
def run_tests(self, *, mutant_name, tests):
715718
with change_cwd('mutants'):
716-
return int(self.execute_pytest(['-x', '-q', '--import-mode=append'] + list(tests)))
719+
return int(self.execute_pytest(['-x', '-q', '--rootdir=.', '--import-mode=append'] + list(tests)))
717720

718721
def run_forced_fail(self):
719722
with change_cwd('mutants'):
@@ -1219,6 +1222,8 @@ def run(mutant_names, *, max_children):
12191222

12201223
def read_one_child_exit_status():
12211224
pid, exit_code = os.wait()
1225+
if mutmut.config.debug:
1226+
print(' worker exit code', exit_code)
12221227
source_file_mutation_data_by_pid[pid].register_result(pid=pid, exit_code=exit_code)
12231228

12241229
source_file_mutation_data_by_pid: Dict[int, SourceFileMutationData] = {} # many pids map to one MutationData
@@ -1266,7 +1271,8 @@ def read_one_child_exit_status():
12661271
os._exit(33)
12671272

12681273
estimated_time_of_tests = sum(mutmut.duration_by_test[test_name] for test_name in tests) + 1
1269-
resource.setrlimit(resource.RLIMIT_CPU, (ceil(estimated_time_of_tests * 2), ceil(estimated_time_of_tests * 2)))
1274+
cpu_time_limit = ceil(estimated_time_of_tests * 2 + process_time()) * 10
1275+
resource.setrlimit(resource.RLIMIT_CPU, (cpu_time_limit, cpu_time_limit))
12701276

12711277
with CatchOutput():
12721278
result = runner.run_tests(mutant_name=mutant_name, tests=tests)

0 commit comments

Comments
 (0)