Skip to content

Commit c51c4a2

Browse files
author
larshertel
committed
moving utils in dedicated file; splitting test_sherpa
1 parent 8e5a144 commit c51c4a2

7 files changed

+188
-396
lines changed

tests/long_tests.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818
along with SHERPA. If not, see <http://www.gnu.org/licenses/>.
1919
"""
2020
from __future__ import print_function
21-
import tempfile
22-
import shutil
2321
import os
2422
import pytest
2523
import sherpa
2624
import sherpa.schedulers
27-
from test_sherpa import test_dir
25+
from testing_utils import *
2826

2927

3028
### The *training script*

tests/test_algorithms.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424
import logging
2525
import itertools
2626
import pytest
27-
from test_sherpa import get_test_trial
28-
29-
30-
logging.basicConfig(level=logging.DEBUG)
31-
testlogger = logging.getLogger(__name__)
27+
from testing_utils import *
3228

3329

3430
def test_median_stopping_rule():

tests/test_schedulers.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,13 @@
2020
import os
2121
import sherpa
2222
import sherpa.schedulers
23-
import socket
2423
import tempfile
2524
import time
26-
import logging
2725
import itertools
2826
import shutil
29-
from test_sherpa import test_dir
27+
from testing_utils import *
3028

3129

32-
logging.basicConfig(level=logging.DEBUG)
33-
testlogger = logging.getLogger(__name__)
34-
3530
# Adjust for testing
3631
SGE_QUEUE_NAME = 'arcus.q'
3732
SGE_PROJECT_NAME = 'arcus_cpu.p'
@@ -100,7 +95,8 @@ def test_local_scheduler(test_dir):
10095

10196
time.sleep(5)
10297
testlogger.debug(s.get_status(job_id))
103-
assert s.get_status(job_id) == sherpa.schedulers._JobStatus.finished
98+
assert s.get_status(job_id) in [sherpa.schedulers._JobStatus.finished, sherpa.schedulers._JobStatus.other]
99+
104100

105101
job_id = s.submit_job(["python", "{}/test.py".format(test_dir)])
106102
time.sleep(1)
@@ -141,6 +137,6 @@ def generate_test_script():
141137

142138
time.sleep(5)
143139
for id in job_ids:
144-
assert s.get_status(id) == sherpa.schedulers._JobStatus.finished
140+
assert s.get_status(id) in [sherpa.schedulers._JobStatus.finished, sherpa.schedulers._JobStatus.other]
145141

146142
assert len(s.resources) == 4*multiple

0 commit comments

Comments
 (0)