diff --git a/news/2 Fixes/5491.md b/news/2 Fixes/5491.md new file mode 100644 index 000000000000..5189b2ad3b19 --- /dev/null +++ b/news/2 Fixes/5491.md @@ -0,0 +1,2 @@ +Fix pytest tests discovery for when flake8 pytest plugin is enabled. +(thanks [Mayeul d'Avezac](https://github.com/mdavezac)) diff --git a/pythonFiles/testing_tools/adapter/pytest.py b/pythonFiles/testing_tools/adapter/pytest.py index 75c6777bc205..c0a2882c1110 100644 --- a/pythonFiles/testing_tools/adapter/pytest.py +++ b/pythonFiles/testing_tools/adapter/pytest.py @@ -228,7 +228,7 @@ def _parse_item(item, _normcase, _pathsep): testfunc = '.'.join(suites) + '.' + funcname else: testfunc = funcname - elif kind == 'doctest': + else: testfunc = None funcname = None @@ -397,7 +397,7 @@ def _get_item_kind(item): return 'function', False elif itemtype == 'TestCaseFunction': return 'function', True - elif item.hasattr('function'): + elif hasattr(item, 'function'): return 'function', False else: return None, False