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

[BUG] A bug when using with pytest-flake8 #919

Closed
wahzzy opened this issue Sep 10, 2019 · 3 comments
Closed

[BUG] A bug when using with pytest-flake8 #919

wahzzy opened this issue Sep 10, 2019 · 3 comments
Milestone

Comments

@wahzzy
Copy link

wahzzy commented Sep 10, 2019

Describe your context

dash                 1.2.0    
dash-core-components 1.1.2    
dash-html-components 1.0.1    
dash-renderer        1.0.1    
dash-table           4.2.0 

Describe the bug

The bug occurs when using 'pytest --flake' to check on .py files.

$ pytest --flake8
Test session starts (platform: linux, Python 3.6.5, pytest 5.1.2, pytest-sugar 0.9.2)
rootdir: /home/wahchi/Desktop/dash_flake
plugins: dash-1.2.0, flake8-1.0.4, sugar-0.9.2, mock-1.10.4
collecting ... INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/_pytest/main.py", line 191, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/_pytest/main.py", line 235, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/_pytest/main.py", line 256, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/_pytest/runner.py", line 72, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/_pytest/runner.py", line 87, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/_pytest/runner.py", line 169, in call_and_report
INTERNALERROR>     report = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/pluggy/callers.py", line 203, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/home/wahchi/.local/share/virtualenvs/dash_flake-d0L80uXN/lib/python3.6/site-packages/dash/testing/plugin.py", line 65, in pytest_runtest_makereport
INTERNALERROR>     for name, fixture in item.funcargs.items():
INTERNALERROR> AttributeError: 'Flake8Item' object has no attribute 'funcargs'

Expected behavior

I wish Dash can work with pytest-flake8.

@byronz
Copy link
Contributor

byronz commented Sep 11, 2019

@wahchi thanks for reporting this issue, we will probably not commit to binding with pytest --flake8, but we can definitely improve to code to make it flake8 compatible.

@byronz byronz added this to the Dash v1.4.0 milestone Sep 11, 2019
@chriddyp chriddyp modified the milestones: Dash v1.x, Dash Q1/2020 Jan 30, 2020
@finnhacks42
Copy link

We were also effected by this issue. It is worth noting that the problem is with pytest --flake8 specifically. Running flake8 directly does not cause problems.

@tophers42
Copy link

Seeing this same issue with pytest-black (0.3.8)

dash (1.11.0)
dash-bootstrap-components (0.8.1)
dash-core-components (1.9.1)
dash-html-components (1.0.3)
dash-renderer (1.4.0)
dash-table (4.6.2)

alexcjohnson added a commit that referenced this issue May 15, 2020
fix #919 - protect against pytest item with no funcargs
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

6 participants