Skip to content

Commit

Permalink
Audit fix and some clean up (microsoft#23599)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Jun 12, 2024
1 parent 40fd53b commit aa216f2
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 77 deletions.
141 changes: 79 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions python_files/tests/unittestadapter/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import pathlib
import sys
from unittest.mock import patch
from typing import Dict
from typing import Dict, Optional

import pytest

script_dir = pathlib.Path(__file__).parent.parent.parent
sys.path.insert(0, os.fspath(script_dir / "lib" / "python"))

from unittestadapter.pvsc_utils import ExecutionPayloadDict, TestResultTypeAlias # noqa: E402
from unittestadapter.pvsc_utils import ExecutionPayloadDict # noqa: E402
from unittestadapter.execution import run_tests # noqa: E402

TEST_DATA_PATH = pathlib.Path(__file__).parent / ".data"
Expand Down Expand Up @@ -64,7 +64,7 @@ def test_single_ids_run(mock_send_run_data):
test_actual = args[0] # first argument is the result

assert test_actual
actual_result: TestResultTypeAlias | None = actual["result"]
actual_result: Optional[Dict[str, Dict[str, Optional[str]]]] = actual["result"]
if actual_result is None:
raise AssertionError("actual_result is None")
else:
Expand Down
9 changes: 3 additions & 6 deletions python_files/unittestadapter/pvsc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
import pathlib
import sys
import unittest
from typing import List, Optional, Tuple, Union, Dict
from typing import List, Optional, Tuple, Union, Dict, Literal, TypedDict


script_dir = pathlib.Path(__file__).parent.parent
sys.path.append(os.fspath(script_dir))
sys.path.append(os.fspath(script_dir / "lib" / "python"))

from testing_tools import socket_manager # noqa: E402
from typing_extensions import Literal, NotRequired, TypeAlias, TypedDict # noqa: E402
from typing_extensions import NotRequired # noqa: E402

# Types

Expand Down Expand Up @@ -52,9 +52,6 @@ class TestExecutionStatus(str, enum.Enum):
success = "success"


TestResultTypeAlias: TypeAlias = Dict[str, Dict[str, Union[str, None]]]


class VSCodeUnittestError(Exception):
"""A custom exception class for unittest errors."""

Expand All @@ -72,7 +69,7 @@ class DiscoveryPayloadDict(TypedDict):
class ExecutionPayloadDict(TypedDict):
cwd: str
status: TestExecutionStatus
result: Optional[TestResultTypeAlias]
result: Optional[Dict[str, Dict[str, Optional[str]]]]
not_found: NotRequired[List[str]]
error: NotRequired[str]

Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ microvenv==2023.5.post1 \
--hash=sha256:32c46afea874e300f69f1add0806eb0795fd02b5fb251092fba0b73c059a7d1f \
--hash=sha256:fd79b3dfea7860e2e84c87dd0aa8a135075f7fa2284174842b7bdeb077a0d8ac
# via -r requirements.in
packaging==24.0 \
--hash=sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5 \
--hash=sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9
packaging==24.1 \
--hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \
--hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124
# via -r requirements.in
tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
Expand All @@ -24,7 +24,7 @@ typing-extensions==4.12.1 \
--hash=sha256:6024b58b69089e5a89c347397254e35f1bf02a907728ec7fee9bf0fe837d203a \
--hash=sha256:915f5e35ff76f56588223f15fdd5938f9a1cf9195c0de25130c627e4d597f6d1
# via -r requirements.in
zipp==3.15.0 \
--hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \
--hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556
zipp==3.19.2 \
--hash=sha256:bf1dcf6450f873a13e952a29504887c89e6de7506209e5b1bcc3460135d4de19 \
--hash=sha256:f091755f667055f2d02b32c53771a7a6c8b47e1fdbc4b72a8b9072b3eef8015c
# via importlib-metadata

0 comments on commit aa216f2

Please sign in to comment.