Joe
Joe

Reputation: 403

pytest - Windows fatal exception: code 0x8001010d

I am trying to run a GUI test using pytest and pywinauto. When I run the code normally, it does not complain.

However, when I am doing it via pytest, it throws a bunch of errors:

Windows fatal exception: code 0x8001010d

Note that the code still executes without problems and the cases are marked as passed. It is just that the output is polluted with these weird Windows exceptions.

What is the reason for this. Should I be concerned?

def test_01():
    app = Application(backend='uia')
    app.start(PATH_TO_MY_APP)
    main = app.window(title_re="MY_APP")
    main.wait('visible', timeout=8) # error occurs here
    time.sleep(0.5)
    win_title = f"MY_APP - New Project"
    assert win_title.upper() == main.texts()[0].upper() # error occurs here

Upvotes: 27

Views: 13383

Answers (4)

mike rodent
mike rodent

Reputation: 15682

W10 box.

Have this problem using pytest 6.2.5 and pytest-qt 4.0.2.

I tried np8's idea: still got a horrible crash (without message).

I tried Felix Zumstein's idea: still got a horrible crash (without message).

Per this thread it appears the issue (in 'Doze) is a crap DLL.

What's strange is that pytest-qt and the qtbot fixture seem to work very well... until I get to this one test. So I have concluded that I have done something too complicated in terms of mocking and patching for this crap 'Doze DLL to cope with.

For example, I mocked out two methods on a QMainWindow subclass which is created at the start of the test. But removing these mocks did not solve the problem. I have so far spent about 2 hours trying to understand what specific feature of this test is so problematic. I am in fact trying to verify the functioning of a method on my main window class which "manufactures" menu items (QWidgets.QAction) based on about 4 parameters.

At this stage I basically have no idea what this "problem feature" is, but it might be the business of inspecting and examining the returned QAction object.

Upvotes: -1

Felix Zumstein
Felix Zumstein

Reputation: 7070

This is an effect of a change introduced with pytest 5.0.0. From the release notes:

#5440: The faulthandler standard library module is now enabled by default to help users diagnose crashes in C modules.

This functionality was provided by integrating the external pytest-faulthandler plugin into the core, so users should remove that plugin from their requirements if used.

For more information see the docs: https://docs.pytest.org/en/stable/usage.html#fault-handler

You can mute these errors as follows:

pytest -p no:faulthandler

Upvotes: 27

Michel Lawaty
Michel Lawaty

Reputation: 19

My workaround for now is to install pytest==4.6.11 With 5.0.0 the problem occurs the first time.

Upvotes: -1

Niko Fohr
Niko Fohr

Reputation: 33918

I had the same problem with Python 3.7.7 32-bit and pytest 5.x.x. It was solved by downgrading pytest to v.4.0.0:

python -m pip install pytest==4.0

Perhaps all Python versions are not compatible with the newest pytest version(s).

Upvotes: 5

Related Questions