From 845db4d79a429eb0adb1a0cc604dd5a055252b29 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 8 Nov 2023 10:05:45 +0000 Subject: [PATCH] Explicitly delete objects before tempfile cleanup to solve windows issue? --- src/somd2/runner/_runner.py | 5 ++--- tests/runner/test_config.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/somd2/runner/_runner.py b/src/somd2/runner/_runner.py index 7d7e134..ef2d8af 100644 --- a/src/somd2/runner/_runner.py +++ b/src/somd2/runner/_runner.py @@ -257,9 +257,8 @@ def get_last_config(output_directory): str(self._config.output_directory / "checkpoint_0.s3") ) except: - _logger.error( - f"Unable to load checkpoint file from {self._config.output_directory}." - ) + expdir = self._config.output_directory / "checkpoint_0.s3" + _logger.error(f"Unable to load checkpoint file from {expdir}.") raise else: last_config = dict(system_temp.property("config")) diff --git a/tests/runner/test_config.py b/tests/runner/test_config.py index 05ec6b3..cd8529f 100644 --- a/tests/runner/test_config.py +++ b/tests/runner/test_config.py @@ -82,9 +82,11 @@ def test_logfile_creation(): config = Config(output_directory=tmpdir, log_file="test.log") assert config.log_file is not None assert Path.exists(config.output_directory / config.log_file) + del config # Instantiate a runner using the default config. # (All default options, other than platform="cpu".) runner = Runner(mols, Config(output_directory=tmpdir, log_file="test1.log")) assert runner._config.log_file is not None assert Path.exists(runner._config.output_directory / runner._config.log_file) + del runner