Skip to content

Commit c315cc5

Browse files
Return an empty result from the pytest adapter if no tests found. (microsoft#5328)
(for microsoft#5327)
1 parent 382b96a commit c315cc5

File tree

4 files changed

+1031
-983
lines changed

4 files changed

+1031
-983
lines changed

pythonFiles/testing_tools/adapter/pytest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ def discover(pytestargs=None, hidestdio=False,
3535
# platform-dependent issues.
3636
with util.hide_stdio() if hidestdio else util.noop_cm():
3737
ec = _pytest_main(pytestargs, [_plugin])
38-
if ec != 0:
38+
# See: https://docs.pytest.org/en/latest/usage.html#possible-exit-codes
39+
if ec == 5:
40+
# No tests were discovered.
41+
pass
42+
elif ec != 0:
3943
raise Exception('pytest discovery failed (exit code {})'.format(ec))
4044
if not _plugin._started:
4145
raise Exception('pytest discovery did not start')

pythonFiles/tests/testing_tools/adapter/.data/notests/tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)