From 0c4664e8f412a53bce167064b885a14821d4382f Mon Sep 17 00:00:00 2001 From: Reigo Reinmets Date: Thu, 23 Dec 2021 17:39:43 +0200 Subject: [PATCH] Lock file is not always left behind so handle it. --- tests/optimize/test_hyperopt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/optimize/test_hyperopt.py b/tests/optimize/test_hyperopt.py index 04fd5d458..5e8d899c8 100644 --- a/tests/optimize/test_hyperopt.py +++ b/tests/optimize/test_hyperopt.py @@ -191,7 +191,11 @@ def test_start_no_data(mocker, hyperopt_conf) -> None: with pytest.raises(OperationalException, match='No data found. Terminating.'): start_hyperopt(pargs) - os.unlink(Hyperopt.get_lock_filename(hyperopt_conf)) + # Cleanup since that failed hyperopt start leaves a lockfile. + try: + os.unlink(Hyperopt.get_lock_filename(hyperopt_conf)) + except Exception: + pass def test_start_filelock(mocker, hyperopt_conf, caplog) -> None: