How to make pytest wait for (manual) user action?

前端 未结 5 1788
抹茶落季
抹茶落季 2021-02-13 15:36

We are sucessfully using pytest (Python 3) to run a test suite testing some hardware devices (electronics). For a subset of these tests, we need the tester to change the hardwa

5条回答
  •  一整个雨季
    2021-02-13 16:25

    For future reference, if you need to use input with pytest. You can do this in any part of your pytest, setup_class, test_..., teardown_method, etc. This is for pytest > 3.3.x

    import pytest
    
    capture_manager = pytest.config.pluginmanager.getplugin('capturemanager')
    capture_manager.suspend_global_capture(in_=True)
    answer = input('My reference text here')
    capture_manager.resume_global_capture()
    

提交回复
热议问题