File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,21 +149,23 @@ def test_export_state_lock_blocks_second_process(tmp_path: Path) -> None:
149149 "with export_state_lock(path):\n "
150150 " Path(acquired).write_text('ok', encoding='utf-8')\n "
151151 )
152- proc = subprocess .Popen (
153- [
154- sys .executable ,
155- "-c" ,
156- child ,
157- str (state_file ),
158- str (attempting_marker ),
159- str (acquired_marker ),
160- ],
161- cwd = str (REPO_ROOT ),
162- )
152+ proc : subprocess .Popen [str ] | None = None
163153 try :
164154 with export_state_lock (str (state_file )):
155+ proc = subprocess .Popen (
156+ [
157+ sys .executable ,
158+ "-c" ,
159+ child ,
160+ str (state_file ),
161+ str (attempting_marker ),
162+ str (acquired_marker ),
163+ ],
164+ cwd = str (REPO_ROOT ),
165+ )
165166 _wait_for_file (attempting_marker )
166167 _assert_file_stays_absent (acquired_marker )
168+ assert proc is not None
167169 try :
168170 assert proc .wait (timeout = 10 ) == 0
169171 except subprocess .TimeoutExpired :
@@ -172,6 +174,6 @@ def test_export_state_lock_blocks_second_process(tmp_path: Path) -> None:
172174 raise
173175 assert acquired_marker .read_text (encoding = "utf-8" ) == "ok"
174176 finally :
175- if proc .poll () is None :
177+ if proc is not None and proc .poll () is None :
176178 proc .kill ()
177179 proc .wait ()
You can’t perform that action at this time.
0 commit comments