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

Internal errors while testing pytest-dependency #58

Closed
DevilXD opened this issue Jan 9, 2022 · 8 comments · Fixed by #59
Closed

Internal errors while testing pytest-dependency #58

DevilXD opened this issue Jan 9, 2022 · 8 comments · Fixed by #59

Comments

@DevilXD
Copy link
Contributor

DevilXD commented Jan 9, 2022

Hello o/

I've ran into some issues while running tests for RKrahl/pytest-dependency#44. Since their test suite always enables all plugins and there isn't an easy way to disable one for the tests, I've had to temporarily uninstall the plugin to finish testing. I figured I'd let you know that there are some unhandled edge cases somewhere in your plugin.

Using order-1.0.0, platform win32 -- Python 3.8.8, pytest-6.2.5, py-1.10.0, pluggy-0.13.1

Tracebacks:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 322, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 337, in traced_hookexec
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 52, in from_call
INTERNALERROR>     result = func()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 335, in <lambda>
INTERNALERROR>     outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 333, in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 637, in perform_collect
INTERNALERROR>     hook.pytest_collection_modifyitems(
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 337, in traced_hookexec
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 52, in from_call
INTERNALERROR>     result = func()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 335, in <lambda>
INTERNALERROR>     outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\plugin.py", line 119, in modify_items
INTERNALERROR>     sorter = Sorter(config, items)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\sorter.py", line 56, in __init__
INTERNALERROR>     self.settings: Settings = Settings(config)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\settings.py", line 63, in __init__
INTERNALERROR>     and auto_mark_dep.lower() in ("1", "yes", "y", "true", "t", "on")
INTERNALERROR> AttributeError: 'bool' object has no attribute 'lower'
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 322, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 337, in traced_hookexec
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 52, in from_call
INTERNALERROR>     result = func()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 335, in <lambda>
INTERNALERROR>     outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 333, in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "C:\Python38\lib\site-packages\_pytest\main.py", line 637, in perform_collect
INTERNALERROR>     hook.pytest_collection_modifyitems(
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 337, in traced_hookexec
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 52, in from_call
INTERNALERROR>     result = func()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 335, in <lambda>
INTERNALERROR>     outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "C:\Python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\plugin.py", line 120, in modify_items
INTERNALERROR>     items[:] = sorter.sort_items()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\sorter.py", line 77, in sort_items
INTERNALERROR>     self.collect_markers()
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\sorter.py", line 295, in collect_markers
INTERNALERROR>     self.mark_binning(item, dep_marks, aliases)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\sorter.py", line 131, in mark_binning
INTERNALERROR>     self.handle_order_mark(item)
INTERNALERROR>   File "C:\Python38\lib\site-packages\pytest_order\sorter.py", line 165, in handle_order_mark
INTERNALERROR>     order = mark.args[0] if mark.args else mark.kwargs.get("index")
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'args'

You can get more by just running tests from the pytest-dependency project while having pytest-order installed.

@mrbean-bremen
Copy link
Member

Thanks, interesting - will check this! Looks like iter_markers can return None in the list, I wouldn't have expected this. This is with your PR branch, right?

@mrbean-bremen
Copy link
Member

Hm, I couldn't reproduce this. In the develop branch, there are no errors in the tests, and in your branch, there are several tests failing with INTERNALERROR> AttributeError: 'bool' object has no attribute 'lower', seems like auto_mark_dep has changed from str to bool or something.

@mrbean-bremen
Copy link
Member

Ah, I had tested with my main branch, not with 1.0.0 - I can reproduce this with the released version (one test failing with that error). So, this is fixed, but not released yet - probably will make a patch release in this case.

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Jan 9, 2022

I just noticed that you also have the other error ('bool' object has no attribute 'lower') in your error listing, I had missed that. That only happens in your branch, though.
Turns out I didn't have the develop version of pytest-dependency installed, but the released version. This does not happen in the released version - obviously the type of the option has changed in develop.

@DevilXD
Copy link
Contributor Author

DevilXD commented Jan 9, 2022

Yeah, well, this was tested with latest releases of both pytest-order and pytest-dependency available from PyPi for Python 3.8, so that'd be pytest-order==1.0.0 and pytest-dependency==0.5.1. But I see that you've figured out most of it already.

@mrbean-bremen
Copy link
Member

Yes - the first problem only happens in the development branch of pytest-dependency, due to the fix of this issue - I fixed this to work with both versions, will make a PR soon. The second issue was already fixed in main, as mentioned.

mrbean-bremen added a commit to mrbean-bremen/pytest-order that referenced this issue Jan 9, 2022
…pendency

- use Python 3.10 instead of pre-release version in CI
- add some documentation links in README
- fixes pytest-dev#58
mrbean-bremen added a commit to mrbean-bremen/pytest-order that referenced this issue Jan 9, 2022
- use Python 3.10 instead of pre-release version in CI
- add some documentation links in README
- fixes pytest-dev#58
mrbean-bremen added a commit that referenced this issue Jan 9, 2022
- use Python 3.10 instead of pre-release version in CI
- add some documentation links in README
- fixes #58
@mrbean-bremen
Copy link
Member

I made a bugfix release with the fixes.

@DevilXD
Copy link
Contributor Author

DevilXD commented Jan 9, 2022

Thank you.

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

Successfully merging a pull request may close this issue.

2 participants