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

AttributeError when using --showlocals with -d #176

Closed
mitzkia opened this issue Jun 30, 2017 · 8 comments
Closed

AttributeError when using --showlocals with -d #176

mitzkia opened this issue Jun 30, 2017 · 8 comments
Labels

Comments

@mitzkia
Copy link

mitzkia commented Jun 30, 2017

Sorry if I putting this issue in wrong place. Maybe it related to pytest (core).
I am searching around the issue database but did not find anything similar.
This is the first time when I am playing with ssh support of xdist plugin. So maybe I am doing something wrong.
My problem is I have got a traceback when am using pytest with "--showlocals" command line parameter, along with "-d". See reproduction below.
I did not get the traceback when

  • I run test locally (without -d), or
  • just removing "--showlocals" when using -d

File contents:

  • pytest.ini
[pytest]
addopts = --tx ssh=root@172.17.0.2//python=python3.5
rsyncdirs = .
  • new_test/test_new.py
def test_new():
    assert False
  • run_with_python3.py
#!/usr/bin/python3
import pytest

def main():
    pytest.main(['--cache-clear', '-v', '--showlocals', '-d', 'new_test/'])

if __name__ == "__main__":
    main()

Reproduction for error:

./run_with_python3.py 
===================================================================================== test session starts =====================================================================================
platform linux -- Python 3.5.3, pytest-3.1.2, py-1.4.34, pluggy-0.4.0 -- /usr/bin/python3
cachedir: .cache
rootdir: /home/micek/pytest_example, inifile: pytest.ini
plugins: mock-1.6.0, cov-2.4.0, xdist-1.18.0, profiling-1.2.6, flakes-2.0.0, docker-0.5.0, pylama-7.3.3
gw0 Iroot@172.17.0.2's password: 
[gw0] linux Python 3.5.2 cwd: /root/pyexecnetcache
[gw0] Python 3.5.2 (default, Nov 17 2016, 17:05:23)  -- [GCC 5.4.0 20160609]
gw0 [1]
scheduling tests via LoadScheduling

new_test/test_new.py::test_new 
[gw0] FAILED new_test/test_new.py::test_new 

========================================================================================== FAILURES ===========================================================================================
__________________________________________________________________________________________ test_new ___________________________________________________________________________________________
[gw0] linux -- Python 3.5.2 /usr/bin/python3.5

    def test_new():
>       assert False
E       assert False

Traceback (most recent call last):
  File "./run_with_python3.py", line 8, in <module>
    main()
  File "./run_with_python3.py", line 5, in main
    pytest.main(['--cache-clear', '-v', '--showlocals', '-d', 'new_test/'])
  File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 58, in main
    return config.hook.pytest_cmdline_main(config=config)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/main.py", line 134, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/main.py", line 128, in wrap_session
    exitstatus=session.exitstatus)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
    wrap_controller.send(call_outcome)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/terminal.py", line 395, in pytest_sessionfinish
    self.summary_failures()
  File "/usr/local/lib/python3.5/dist-packages/_pytest/terminal.py", line 520, in summary_failures
    self._outrep_summary(rep)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/terminal.py", line 544, in _outrep_summary
    rep.toterminal(self._tw)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/runner.py", line 196, in toterminal
    longrepr.toterminal(out)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/_code/code.py", line 740, in toterminal
    self.reprtraceback.toterminal(tw)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/_code/code.py", line 756, in toterminal
    entry.toterminal(tw)
  File "/usr/local/lib/python3.5/dist-packages/_pytest/_code/code.py", line 807, in toterminal
    self.reprlocals.toterminal(tw)
AttributeError: 'dict' object has no attribute 'toterminal'
@RonnyPfannschmidt
Copy link
Member

@timyhou this looks like fallout of #164 and #171 - can you have a look

@mitzkia as workaround until this is resolved, please use pytest-xdist<1.18.0

@mitzkia
Copy link
Author

mitzkia commented Jun 30, 2017

Hi,

Thank you very much. I will check that.

@RonnyPfannschmidt
Copy link
Member

@mitzkia the bug is still real tho ^^ thanks for the note and it will likely happen again unless you downgrade until we fix the issue ^^

@mitzkia
Copy link
Author

mitzkia commented Jun 30, 2017

Ok, thanks I will downgrade.

Thank you.

@timyhou
Copy link

timyhou commented Jun 30, 2017

I'll take a look.

@timyhou
Copy link

timyhou commented Jun 30, 2017

@mitzkia and @RonnyPfannschmidt I found the issue. I'll have a PR up soon. I am adding more tests to thoroughly test what is normally the issue.

@nicoddemus
Copy link
Member

Awesome @timyhou, thanks!

@nicoddemus
Copy link
Member

Fixed in #178

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

No branches or pull requests

4 participants