fix: propagate exit code (#108)

* fix(pytest): propagate exit code

* feat: derive exit code for unittest
This commit is contained in:
Salomon Popp
2026-08-18 16:39:57 +03:00
committed by Itai Bohadana
parent 7d7cacb91a
commit b720009f3e
6 changed files with 21 additions and 20 deletions
+4 -4
View File
@@ -4,7 +4,7 @@ from typing import Callable, Dict, List, Optional, Union
from . import params_getter
from io import StringIO
from pathlib import Path
from typing import Callable, Dict, Generator, List, Optional, Union
from typing import Callable, Dict, Generator, List, Optional, Tuple, Union
import pytest
from _pytest._code.code import ExceptionRepr
@@ -24,18 +24,18 @@ class PytestNeotestAdapter(NeotestAdapter):
self,
args: List[str],
stream: Callable[[str, NeotestResult], None],
) -> Dict[str, NeotestResult]:
) -> Tuple[Dict[str, NeotestResult], int]:
result_collector = NeotestResultCollector(
self, stream=stream, emit_parameterized_ids=self.emit_parameterized_ids
)
pytest.main(
exit_code = pytest.main(
args=args,
plugins=[
result_collector,
NeotestDebugpyPlugin(),
],
)
return result_collector.results
return result_collector.results, int(exit_code)
class NeotestResultCollector: