@@ -40,6 +40,26 @@ class PytestNeotestAdapter(NeotestAdapter):
|
|||||||
from _pytest._code.code import ExceptionChainRepr
|
from _pytest._code.code import ExceptionChainRepr
|
||||||
|
|
||||||
class NeotestResultCollector:
|
class NeotestResultCollector:
|
||||||
|
@staticmethod
|
||||||
|
def pytest_deselected(items: List):
|
||||||
|
for report in items:
|
||||||
|
file_path, *name_path = report.nodeid.split("::")
|
||||||
|
abs_path = str(Path(pytest_config.rootpath, file_path))
|
||||||
|
test_name, *namespaces = reversed(name_path)
|
||||||
|
valid_test_name, *params = test_name.split("[") # ]
|
||||||
|
pos_id = "::".join([abs_path, *namespaces, valid_test_name])
|
||||||
|
result = self.update_result(
|
||||||
|
results.get(pos_id),
|
||||||
|
{
|
||||||
|
"short": None,
|
||||||
|
"status": NeotestResultStatus.SKIPPED,
|
||||||
|
"errors": [],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if not params:
|
||||||
|
stream(pos_id, result)
|
||||||
|
results[pos_id] = result
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pytest_cmdline_main(config: "Config"):
|
def pytest_cmdline_main(config: "Config"):
|
||||||
nonlocal pytest_config
|
nonlocal pytest_config
|
||||||
@@ -55,6 +75,7 @@ class PytestNeotestAdapter(NeotestAdapter):
|
|||||||
abs_path = str(Path(pytest_config.rootpath, file_path))
|
abs_path = str(Path(pytest_config.rootpath, file_path))
|
||||||
test_name, *namespaces = reversed(name_path)
|
test_name, *namespaces = reversed(name_path)
|
||||||
valid_test_name, *params = test_name.split("[") # ]
|
valid_test_name, *params = test_name.split("[") # ]
|
||||||
|
pos_id = "::".join([abs_path, *namespaces, valid_test_name])
|
||||||
|
|
||||||
errors: List[NeotestError] = []
|
errors: List[NeotestError] = []
|
||||||
short = self.get_short_output(pytest_config, report)
|
short = self.get_short_output(pytest_config, report)
|
||||||
@@ -80,7 +101,6 @@ class PytestNeotestAdapter(NeotestAdapter):
|
|||||||
raise Exception(
|
raise Exception(
|
||||||
"Unhandled error type, please report to neotest-python repo"
|
"Unhandled error type, please report to neotest-python repo"
|
||||||
)
|
)
|
||||||
pos_id = "::".join([abs_path, *namespaces, valid_test_name])
|
|
||||||
result = self.update_result(
|
result = self.update_result(
|
||||||
results.get(pos_id),
|
results.get(pos_id),
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user