How Run Py.test from PyScripter

san santosh.ssit at gmail.com
Wed Nov 14 13:07:38 EST 2012


I am a newbie to py.test , Please let me know how to run the py.test in PyScripter Editor. I have tried in the belwo way but it doesn't work.

import pytest

def func(x): return x + 1

def test_answer(): assert func(3) == 5

pytest.main()

below is the Exception that i get 

Traceback (most recent call last):
  File "<module1>", line 10, in <module>
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 474, in main
    exitstatus = config.hook.pytest_cmdline_main(config=config)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 422, in __call__
    return self._docall(methods, kwargs)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 433, in _docall
    res = mc.execute()
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 351, in execute
    res = method(**kwargs)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\main.py", line 107, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\main.py", line 92, in wrap_session
    config.pluginmanager.notify_exception(excinfo, config.option)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 285, in notify_exception
    res = self.hook.pytest_internalerror(excrepr=excrepr)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 422, in __call__
    return self._docall(methods, kwargs)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 433, in _docall
    res = mc.execute()
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py", line 351, in execute
    res = method(**kwargs)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\terminal.py", line 152, in pytest_internalerror
    self.write_line("INTERNALERROR> " + line)
  File "C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\terminal.py", line 140, in write_line
    self._tw.line(line, **markup)
  File "C:\Python27\lib\site-packages\py-1.4.11-py2.7.egg\py\_io\terminalwriter.py", line 181, in line
    self.write(s, **kw)
  File "C:\Python27\lib\site-packages\py-1.4.11-py2.7.egg\py\_io\terminalwriter.py", line 225, in write
    self._file.write(msg)
  File "C:\Python27\lib\site-packages\py-1.4.11-py2.7.egg\py\_io\terminalwriter.py", line 241, in write
    self._writemethod(data)
TypeError: 'AsyncStream' object is not callable



More information about the Python-list mailing list