Home > Back-end >  Python unit test fails with Exit Code 138 & Empty suite errors
Python unit test fails with Exit Code 138 & Empty suite errors

Time:01-03

I am able to run this Python test directly from IntelliJ:

from unittest import TestCase

class TestDebug(TestCase):

    def test_debug(self):
        print("test")

Output:

/Users/work/dev/venv/bin/python3 "/Users/work/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ IDEA.app.plugins/python/helpers/pycharm/_jb_unittest_runner.py" --target test_debug.TestDebug
Testing started at 9:45 AM ...
Launching unittests with arguments python -m unittest test_debug.TestDebug in /Users/work/dev/tests
Ran 1 test in 0.001s
OK
Process finished with exit code 0
test

However, when running it in a debug mode it fails with this output:

/Users/work/dev/venv/bin/python3 "/Users/work/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ IDEA.app.plugins/python/helpers/pydev/pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 57545 --file "/Users/work/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ IDEA.app.plugins/python/helpers/pycharm/_jb_unittest_runner.py" --target test_debug.TestDebug
Testing started at 9:45 AM ...
Connected to pydev debugger (build 213.5744.223)
Process finished with exit code 138 (interrupted by signal 10: SIGBUS)
Empty suite
Empty suite

Any help is appreciated!

CodePudding user response:

This appears to be caused by a Cython issue. You can work around this problem by setting the following in your run/debug configuration or your environment:

PYDEVD_USE_CYTHON=NO
PYDEVD_USE_FRAME_EVAL=NO
  • Related