@pytest.fixture
def lineedit(qtbot, monkeypatch):
 le = LineEdit()
 qtbot.add_widget(le)
 monkeypatch.setattr(QApplication.instance(), 'focusWidget', (lambda : le))
 return le

@ pytest . fixture def lineedit ( qtbot , monkeypatch ) : le = LineEdit ( ) qtbot . add_widget ( le ) monkeypatch . setattr ( QApplication . instance ( ) , 'focusWidget' , ( lambda : le ) ) return le
fixture providing a lineedit .