dimanche 23 avril 2017

How to add stdin interaction with pytest

I am writing integration tests for a system where I can automate most of the test via web service calls, but due to legacy-ness that I cannot change, I need a few steps to be done by manual testers.

I wanted to use pytest and create a fixture that essentially pauses test execution and prompts the console for input (e.g. "Do XYZ in system; type 'done' when done") and continues with the remainder of the test.

I admittedly haven't done a ton of hacking on this yet, but I see from pytest docs that:

... stdin is set to a “null” object which will fail on attempts to read from it because it is rarely desired to wait for interactive input when running automated tests.

Except, in my case, I really do want to wait, and other than this, my stuff looks to be a great use case for pytest.

Still searching the interwebs for hints, but if someone has gotten past this roadblock already I'd love to know.

Aucun commentaire:

Enregistrer un commentaire