MCPcopy
hub / github.com/CITGuru/PyInquirer / create_example_fixture

Function create_example_fixture

tests/helpers.py:246–261  ·  view source on GitHub ↗

Create a pytest fixture to run the example in pty subprocess & cleanup. :param example: relative path like 'examples/input.py' :return: pytest fixture

(example)

Source from the content-addressed store, hash-verified

244
245
246def create_example_fixture(example):
247 """Create a pytest fixture to run the example in pty subprocess & cleanup.
248
249 :param example: relative path like 'examples/input.py'
250 :return: pytest fixture
251 """
252 @pytest.fixture
253 def example_app():
254 p = SimplePty.spawn(['python', example])
255 yield p
256 # it takes some time to collect the coverage data
257 # if the main process exits too early the coverage data is not available
258 time.sleep(p.delayafterterminate)
259 p.sendintr() # in case the subprocess was not ended by the test
260 p.wait() # without wait() the coverage info never arrives
261 return example_app

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…