Skip to content

Commit

Permalink
update test_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DE0CH committed Dec 19, 2022
1 parent 05e73a3 commit f92edb0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import json
def target_runner(experiment, scenario):
raise ValueError()
return dict(cost=experiment['configuration']['one'])


params = '''
Expand All @@ -33,16 +32,23 @@ def target_runner(experiment, scenario):
def test_no_hang():
p = Process(target=start_irace)
p.start()
Timer(1, kill_process, args=(p,)).start()
sleep(2)
Timer(1, sigterm_process, args=(p,)).start()
Timer(2, sigkill_process, args=(p,)).start()
sleep(3)
assert not killed

def kill_process(p):
def sigterm_process(p):
if p.is_alive():
p.terminate()
global killed
killed = True

def sigkill_process(p):
if p.is_alive():
p.kill()
global killed
killed = True

def start_irace():
tuner = irace(scenario, params, target_runner)
tuner.set_initial(defaults)
Expand Down

0 comments on commit f92edb0

Please sign in to comment.