Search code examples
pythonpytestpytest-html

Getting unwanted “Windows fatal exception” on running “pywinatuo” script on Lenovo laptop


I don't know why the same script is running fine on one system and throwing lot of fatal exception on other models

Environment Python version: 3.7.2 (tried with both 32 & 64 bit executable) Pywinauto: 0.6.8 Operating system: Windows 10 (Build version: 16299) Laptop Model: yoga

Also tried with installing python & pywinatuo as Administrative mode but still getting the same error message.

> Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32

'''def test_powerpoint_perf_activity():
      os.startfile(testfilepath)
      connectApp=
      Application(backend='uia').connect(title_re='.*'+file_name+'*.')
      connectWindow = connectApp.window(title_re='.*'+file_name+'*.')

      if connectWindow.is_maximized() == False:
         connectWindow.MaximizeButton.click_input()

      connectWindow.HOMETabItem.click_input()
      connectWindow.NewSlideMenuItem.click_input()
      connectWindow.TitleandTextListItem.click_input()'''

platform win32 -- Python 3.7.2, pytest-5.2.2, py-1.8.0, pluggy-0.13.0

  c:\python37_32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.2', 'Platform': 'Windows-10-10.0.16299-SP0', 'Packages': {'pytest': '5.2.2', 'py':

'1.8.0', 'pluggy': '0.13.0'}, 'Plugins': {'allure-pytest': '2.8.6', 'html': '2.0.0', 'metadata': '1.8.0'}} rootdir: C:\securityapps_master_m\testcases enter code hereplugins: allure-pytest-2.8.6, html-2.0.0, metadata-1.8.0 collecting ... ERROR: The process "POWERPNT.EXE" not found. ERROR: The process "IEXPLORE.EXE" not found. collected 1 item

test_san_tool.py::test_TC02_Dictionary Windows fatal exception: code 0xe0000002
Thread 0x00002ea0 (most recent call first):
  File "C:\securityapps_master_m\testcases\test_san_tool.py", line 37 in test_TC02_Dictionary
  File "c:\python37_32\lib\site-packages\_pytest\python.py", line 170 in pytest_pyfunc_call
  File "c:\python37_32\lib\site-packages\pluggy\callers.py", line 187 in _multicall
  File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 86 in <lambda>
  File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 92 in _hookexec
  File "c:\python37_32\lib\site-packages\pluggy\hooks.py", line 286 in __call__
  File "c:\python37_32\lib\site-packages\_pytest\python.py", line 1423 in runtest
  File "c:\python37_32\lib\site-packages\_pytest\runner.py", line 125 in pytest_runtest_call
  File "c:\python37_32\lib\site-packages\pluggy\callers.py", line 187 in _multicall
  File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 86 in <lambda>
  File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 92 in _hookexec
  File "c:\python37_32\lib\site-packages\pluggy\hooks.py", line 286 in __call__
  File "c:\python37_32\lib\site-packages\_pytest\runner.py", line 201 in <lambda>
  File "c:\python37_32\lib\site-packages\_pytest\runner.py", line 229 in from_call
  File "c:\python37_32\lib\site-packages\_pytest\runner.py", line 201 in call_runtest_hook
  File "c:\python37_32\lib\site-packages\_pytest\runner.py", line 176 in call_and_report
  File "c:\python37_32\lib\site-packages\_pytest\runner.py", line 95 in runtestprotocol
  File "c:\python37_32\lib\site-packages\_pytest\runner.py", line 80 in pytest_runtest_protocol
  File "c:\python37_32\lib\site-packages\pluggy\callers.py", line 187 in _multicall
  File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 86 in <lambda>
  File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 92 in _hookexec
  File "c:\python37_32\lib\site-packages\pluggy\hooks.py", line 286 in __call__
  File "c:\python37_32\lib\site-packages\_pytest\main.py", line 258 in pytest_runtestloop
  File "c:\python37_32\lib\site-packages\pluggy\callers.py", line 187 in _multicall
  File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 86 in <lambda>                                                        

File "c:\python37_32\lib\site-packages\pluggy\manager.py", line 92 in _hookexec File "c:\python37_32\lib\site-packages\pluggy\hooks.py", line 286 in call


Solution

  • I had this exact same problem. my python version was,

    $ python --version Python 3.7.2

    and my pytest was

    pytest==5.3.5. I got the exact the same problem you got.

    I downgraded the pytest to 4.0.0 and it worked perfectly fine.

    On another machine with a python version of 3.7.0 and pytest==5.3.5, i did not notice the problem.

    Therefore, either downgrading the python from 3.7.2 to 3.7.0 or downgrading the pytest to a lower version will work.I hope this solves your problem.