5

Building on top of How to assert output with nosetest/unittest in python? I would like to acieve this inside Pyharm. However, pycharm does not run:

$ python -m tests.test_mymodule --buffer

Rather it does:

$ /usr/bin/python2.7 /opt/helpers/pycharm/utrunner.py \
  /home/oz123/PycharmProjects/account/tests/test_mymodule.py true

So, I ran it with:

$ /usr/bin/python2.7 /opt/helpers/pycharm/utrunner.py \
  /home/oz123/PycharmProjects/account/tests/test_mymodule.py --buffer true

And it crashes with:

##teamcity[testFinished duration='72' name='test_1_list_files']
Traceback (most recent call last):
  File "/opt/helpers/pycharm/utrunner.py", line 151, in <module>
    TeamcityTestRunner().run(all, **options)
  File "/opt/helpers/pycharm/tcunittest.py", line 249, in run
    test(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/unittest/suite.py", line 108, in run
    test(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/unittest/suite.py", line 108, in run
    test(result)
  File "/usr/lib/python2.7/unittest/case.py", line 396, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/unittest/case.py", line 356, in run
    result.addError(self, sys.exc_info())
  File "/opt/helpers/pycharm/tcunittest.py", line 108, in addError
    TestResult.addError(self, test, err)
  File "/usr/lib/python2.7/unittest/result.py", line 19, in inner
    return method(self, *args, **kw)
  File "/usr/lib/python2.7/unittest/result.py", line 116, in addError
    self.errors.append((test, self._exc_info_to_string(err, test)))
  File "/usr/lib/python2.7/unittest/result.py", line 167, in _exc_info_to_string
    output = sys.stdout.getvalue()
AttributeError: 'file' object has no attribute 'getvalue'

Does any one know where does pycharm store the output? How can I access it?

2
  • Did you ever find a solution? Commented Feb 5, 2019 at 0:06
  • 1
    not that I remember. I stopped using PyCharm and went back to vim ... Commented Feb 5, 2019 at 5:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.