From 66ae415ba019fa4528f61a23948e56a713902295 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 17 Feb 2016 15:44:40 +0100 Subject: Prolog: only catch timeout in test functions --- prolog/problems/clp_fd/gcd_3/common.py | 2 +- prolog/problems/clp_fd/magic_1/common.py | 2 +- prolog/problems/clp_fd/puzzle_abc_3/common.py | 2 +- prolog/problems/clp_fd/puzzle_beth_1/common.py | 2 +- prolog/problems/clp_fd/puzzle_momson_2/common.py | 2 +- prolog/problems/clp_fd/puzzle_ratio_2/common.py | 2 +- prolog/problems/clp_fd/tobase_3/common.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'prolog/problems/clp_fd') diff --git a/prolog/problems/clp_fd/gcd_3/common.py b/prolog/problems/clp_fd/gcd_3/common.py index 82ffb28..5048a73 100644 --- a/prolog/problems/clp_fd/gcd_3/common.py +++ b/prolog/problems/clp_fd/gcd_3/common.py @@ -45,7 +45,7 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 - except: + except socket.timeout: pass finally: if engine_id: diff --git a/prolog/problems/clp_fd/magic_1/common.py b/prolog/problems/clp_fd/magic_1/common.py index 7978c02..c9e89c7 100644 --- a/prolog/problems/clp_fd/magic_1/common.py +++ b/prolog/problems/clp_fd/magic_1/common.py @@ -43,7 +43,7 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 - except: + except socket.timeout: pass finally: if engine_id: diff --git a/prolog/problems/clp_fd/puzzle_abc_3/common.py b/prolog/problems/clp_fd/puzzle_abc_3/common.py index 95458ab..74275e9 100644 --- a/prolog/problems/clp_fd/puzzle_abc_3/common.py +++ b/prolog/problems/clp_fd/puzzle_abc_3/common.py @@ -35,7 +35,7 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 - except: + except socket.timeout: pass finally: if engine_id: diff --git a/prolog/problems/clp_fd/puzzle_beth_1/common.py b/prolog/problems/clp_fd/puzzle_beth_1/common.py index 0a2bbb6..50bdf08 100644 --- a/prolog/problems/clp_fd/puzzle_beth_1/common.py +++ b/prolog/problems/clp_fd/puzzle_beth_1/common.py @@ -30,7 +30,7 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 - except: + except socket.timeout: pass finally: if engine_id: diff --git a/prolog/problems/clp_fd/puzzle_momson_2/common.py b/prolog/problems/clp_fd/puzzle_momson_2/common.py index 927b250..cd423fb 100644 --- a/prolog/problems/clp_fd/puzzle_momson_2/common.py +++ b/prolog/problems/clp_fd/puzzle_momson_2/common.py @@ -37,7 +37,7 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 - except: + except socket.timeout: pass finally: if engine_id: diff --git a/prolog/problems/clp_fd/puzzle_ratio_2/common.py b/prolog/problems/clp_fd/puzzle_ratio_2/common.py index 914f4d1..d62a15f 100644 --- a/prolog/problems/clp_fd/puzzle_ratio_2/common.py +++ b/prolog/problems/clp_fd/puzzle_ratio_2/common.py @@ -38,7 +38,7 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 - except: + except socket.timeout: pass finally: if engine_id: diff --git a/prolog/problems/clp_fd/tobase_3/common.py b/prolog/problems/clp_fd/tobase_3/common.py index 2b5f37a..e358210 100644 --- a/prolog/problems/clp_fd/tobase_3/common.py +++ b/prolog/problems/clp_fd/tobase_3/common.py @@ -46,7 +46,7 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 - except: + except socket.timeout: pass finally: if engine_id: -- cgit v1.2.1