Pycharm hangs on unittests indefinitely if there is a print statement present

I set up a brand new PyCharm project to test this in. As of several hours ago, I could have print statements all over the place with no problem whatsoever. As of right now, having any print statements within any project causes the whole process to spin forever, eventually being closed out automatically by my OS with the code 137 SIGKILL 9 command.

The following code is the most stripped down demonstration of this I could come up with:

import unittest

def hellothere():
    pass

class TestTest(unittest.TestCase):
    def setUp(self):
        stuff = hellothere()
        print(stuff)

    def test(self):
        pass

It's worth noting that changing `stuff = hellothere()` to `stuff = str(hellothere())` and removing the print works, and returning instead of printing works as well.

I tried setting this up in terminal, but when I run this in terminal, I get `ValueError: no such test method in <class '__main__.TestTest'>: runTest`.

dmesg reports `low swap: killing largest compressed process with pid 6093 (python2.7) and size 1051 MB` but I can't find any other relevant information in there.

I'm using pycharm verion info below:

and python 2.7.

1 comment
Comment actions Permalink

I just figured it out. The virtual environment that was being used in my project interpreter was just copied over when I created a new project which is why creating a new project didn't fix it. I created a new interpreter with a new virtual environment, and problem solved!

0

Please sign in to leave a comment.