Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'TerminalWriter' object has no attribute 'chars_on_current_line' #2961

Closed
fim opened this issue Nov 28, 2017 · 5 comments
Closed

'TerminalWriter' object has no attribute 'chars_on_current_line' #2961

fim opened this issue Nov 28, 2017 · 5 comments

Comments

@fim
Copy link

fim commented Nov 28, 2017

Seems like the latest change broke TerminalWriter. When I try to use pytest I get the following:

pytest-error % virtualenv /tmp/test -p python2.7 --no-site-packages
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /tmp/test/bin/python2.7
Also creating executable in /tmp/test/bin/python
Installing setuptools, pip, wheel...done.
pytest-error % . /tmp/test/bin/activate
(test) pytest-error % pip install -U tox 
Collecting tox
  Using cached tox-2.9.1-py2.py3-none-any.whl
Collecting virtualenv>=1.11.2; python_version != "3.2" (from tox)
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Collecting py>=1.4.17 (from tox)
  Using cached py-1.5.2-py2.py3-none-any.whl
Collecting six (from tox)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting pluggy<1.0,>=0.3.0 (from tox)
Installing collected packages: virtualenv, py, six, pluggy, tox
Successfully installed pluggy-0.6.0 py-1.5.2 six-1.11.0 tox-2.9.1 virtualenv-15.1.0
(test) pytest-error % cat tox.ini
[tox]
envlist = py27

[testenv]
basepython = python2.7
deps =
  -rrequirements.txt
  .
  pytest
  flake8
  flake8-import-order
commands =
  flake8 --exclude=env --import-order-style=google src bin setup.py --ignore=E501,E266
  pytest
setenv =
     PYTHONPATH = {toxinidir}:.
(test) pytest-error % tox --recreate
GLOB sdist-make: /tmp/pytest-error/setup.py
py27 recreate: /tmp/pytest-error/.tox/py27
py27 installdeps: -rrequirements.txt, ., pytest, flake8, flake8-import-order
py27 inst: /tmp/pytest-error/.tox/dist/ssscan2-0.0.1.zip
py27 installed: attrs==17.3.0,boto3==1.4.5,botocore==1.5.95,certifi==2017.7.27.1,cffi==1.10.0,chardet==3.0.4,click==6.7,configparser==3.5.0,docutils==0.14,enum34==1.1.6,falcon==1.2.0,flake8==3.5.0,flake8-import-order==0.16,funcsigs==1.0.2,future==0.16.0,futures==3.1.1,idna==2.5,jmespath==0.9.3,mccabe==0.6.1,pefile==2017.8.1,pluggy==0.4.0,py==1.4.34,pyasn1==0.3.2,pycodestyle==2.3.1,pycparser==2.18,pyflakes==1.6.0,pytest==3.3.0,python-dateutil==2.6.1,python-mimeparse==1.6.0,requests==2.18.3,s3transfer==0.1.10,simplejson==3.11.1,six==1.10.0,ssdeep==3.2,ssscan2==0.0.1,tox==2.7.0,urllib3==1.22,virtualenv==15.1.0,virustotal-api==1.1.7,yara-python==3.6.3
py27 runtests: PYTHONHASHSEED='2290775306'
py27 runtests: commands[0] | flake8 --exclude=env --import-order-style=google src bin setup.py --ignore=E501,E266
py27 runtests: commands[1] | pytest
===================================== test session starts =====================================
platform linux2 -- Python 2.7.12, pytest-3.3.0, py-1.4.34, pluggy-0.4.0
rootdir: /tmp/pytest-error, inifile:
collected 30 items                                                                            

tests/test_endpoints.py .
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/main.py", line 103, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/main.py", line 141, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 613, in execute
INTERNALERROR>     return _wrapped_call(hook_impl.function(*args), self.execute)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 254, in _wrapped_call
INTERNALERROR>     return call_outcome.get_result()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 280, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 265, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/main.py", line 164, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 613, in execute
INTERNALERROR>     return _wrapped_call(hook_impl.function(*args), self.execute)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 254, in _wrapped_call
INTERNALERROR>     return call_outcome.get_result()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 280, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 265, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 613, in execute
INTERNALERROR>     return _wrapped_call(hook_impl.function(*args), self.execute)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 254, in _wrapped_call
INTERNALERROR>     return call_outcome.get_result()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 280, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 265, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/runner.py", line 63, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/runner.py", line 77, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/runner.py", line 161, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/terminal.py", line 275, in pytest_runtest_logreport
INTERNALERROR>     self._write_progress_if_past_edge()
INTERNALERROR>   File "/tmp/pytest-error/.tox/py27/lib/python2.7/site-packages/_pytest/terminal.py", line 308, in _write_progress_if_past_edge
INTERNALERROR>     past_edge = self._tw.chars_on_current_line + self._PROGRESS_LENGTH + 1 >= self._screen_width
INTERNALERROR> AttributeError: 'TerminalWriter' object has no attribute 'chars_on_current_line'

removing temp directory

================================== 1 passed in 0.82 seconds ===================================
ERROR: InvocationError: '/tmp/pytest-error/.tox/py27/bin/pytest'
___________________________________________ summary ___________________________________________
ERROR:   py27: commands failed
  • pip list info:
$ pip (9.0.1)
pluggy (0.6.0)
py (1.5.2)
setuptools (38.2.3)
six (1.11.0)
tox (2.9.1)
virtualenv (15.1.0)
wheel (0.30.0)

It seems like the chars_on_current_line() method is missing from the codebase

@fim
Copy link
Author

fim commented Nov 28, 2017

Forgot to mention that reverting to pytest==3.2.5 solves the problem!

@The-Compiler
Copy link
Member

Your pip list seems to be from a different environment, as pytest says it's using py-1.4.34 above.

Can you test upgrading py to 1.5.2 please?

@nicoddemus
Copy link
Member

Yep, TerminalWriter.chars_on_current_line was added in py-1.5.0. Our setup.py also requires py>=1.5.0 so I'm not sure why it didn't upgrade your py to 1.5.2 automatically.

As @The-Compiler suggests, please try to upgrade py manually, it should fix your problem.

@fim
Copy link
Author

fim commented Nov 28, 2017

That fixed it. I think there was another requirement that was pulling py==1.4.X and for some reason pip wasn't complaining. Feel free to close this.

Thanks for the quick reply!

@fim fim closed this as completed Nov 28, 2017
@RonnyPfannschmidt
Copy link
Member

@fim another case for pypa/pip#988

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants