test: close unclosed file handles in tests (Path read/write)
Replace bare open().read()/write() in tests with Path.read_text/
write_text (or json.loads over read_text); the five remaining
open(...).close() empty-file creations become Path.write_text('').
No assertion, predicate, or production code changed; no behaviour
change beyond closing the handle deterministically.
Long-function splits and server.py module split intentionally not
included: the longest functions (_dispatch, _create_task,
_dispatch_project, ~375-395 lines in a 10430-line server.py) are
central routing/creation paths, and splitting them is not low-risk;
see PR body.
This commit is contained in:
1 parent
82d0e84371
commit
7b537c31a6
9 files changed
+61
-57
No files matched your search
@@ -347,7 +347,7 @@ class TestDockerExtraMounts(DockerCommandTestCase):
|
||||
work = os.path.join(td, "work")
|
||||
os.makedirs(work)
|
||||
state = os.path.join(td, "host-state.json")
|
||||
open(state, "w").write("{}")
|
||||
Path(state).write_text("{}", encoding="utf-8")
|
||||
with mock.patch("cloud.sandbox.shutil.which",
|
||||
return_value="/usr/bin/docker"):
|
||||
ex = DockerExecutor("/fake/host.py", runner=_ok_runner_factory([]),
|
||||
|
||||
Reference in new issue
Block a user