MCPcopy Create free account
hub / github.com/pytest-dev/pytest / done

Method done

src/_pytest/capture.py:405–419  ·  view source on GitHub ↗

Stop capturing, restore streams, return original capture file, seeked to position zero.

(self)

Source from the content-addressed store, hash-verified

403 return res
404
405 def done(self) -> None:
406 """Stop capturing, restore streams, return original capture file,
407 seeked to position zero."""
408 self._assert_state("done", ("initialized", "started", "suspended", "done"))
409 if self._state == "done":
410 return
411 os.dup2(self.targetfd_save, self.targetfd)
412 os.close(self.targetfd_save)
413 if self.targetfd_invalid is not None:
414 if self.targetfd_invalid != self.targetfd:
415 os.close(self.targetfd)
416 os.close(self.targetfd_invalid)
417 self.syscapture.done()
418 self.tmpfile.close()
419 self._state = "done"
420
421 def suspend(self) -> None:
422 self._assert_state("suspend", ("started", "suspended"))

Callers 9

stop_capturingMethod · 0.45
test_simpleMethod · 0.45
test_stderrMethod · 0.45
test_stdinMethod · 0.45
test_writeorgMethod · 0.45

Calls 2

_assert_stateMethod · 0.95
closeMethod · 0.45

Tested by 8

test_simpleMethod · 0.36
test_stderrMethod · 0.36
test_stdinMethod · 0.36
test_writeorgMethod · 0.36