Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions python_files/tests/unittestadapter/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,10 @@ def test_build_empty_tree() -> None:
start_dir = os.fsdecode(TEST_DATA_PATH)
pattern = "does_not_exist*"

expected = None

loader = unittest.TestLoader()
suite = loader.discover(start_dir, pattern)
tests, errors = build_test_tree(suite, start_dir)

assert expected == tests
assert tests is not None
assert tests.get("children") == []
assert not errors
10 changes: 7 additions & 3 deletions python_files/unittestadapter/pvsc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import argparse
import atexit
import doctest
import enum
import inspect
import json
Expand Down Expand Up @@ -202,6 +203,12 @@ def build_test_tree(
root = build_test_node(top_level_directory, directory_path.name, TestNodeTypeEnum.folder)

for test_case in get_test_case(suite):
if isinstance(test_case, doctest.DocTestCase):
print(
"Skipping doctest as it is not supported for the extension. Test case: ", test_case
)
error = ["Skipping doctest as it is not supported for the extension."]
continue
test_id = test_case.id()
if test_id.startswith("unittest.loader._FailedTest"):
error.append(str(test_case._exception)) # type: ignore # noqa: SLF001
Expand Down Expand Up @@ -255,9 +262,6 @@ def build_test_tree(
} # concatenate class name and function test name
current_node["children"].append(test_node)

if not root["children"]:
root = None

return root, error


Expand Down
Loading