Skip to content

Commit

Permalink
Merge branch 'microsoft:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd authored Apr 11, 2023
2 parents 1374370 + f058f5e commit 9f67fbe
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 48 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/triage-info-needed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
env:
KEYWORDS: '["\\?", "please", "kindly", "let me know", "try", "can you", "could you", "would you", "may I", "provide", "let us know", "tell me", "give me", "send me", "what", "when", "where", "why", "how"]'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check for author
uses: actions/github-script@v6
with:
Expand Down Expand Up @@ -48,8 +46,6 @@ jobs:
if: contains(github.event.issue.labels.*.name, 'info-needed') && contains(github.event.issue.labels.*.name, 'triage-needed')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check for author
uses: actions/github-script@v6
with:
Expand Down
80 changes: 61 additions & 19 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@
"vscode-tas-client": "^0.1.63",
"which": "^2.0.2",
"winreg": "^1.2.4",
"xml2js": "^0.4.19"
"xml2js": "^0.5.0"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
Expand Down
94 changes: 94 additions & 0 deletions pythonFiles/tests/unittestadapter/test_execution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import os
import pathlib
from typing import List

import pytest
from unittestadapter.execution import parse_execution_cli_args, run_tests

TEST_DATA_PATH = pathlib.Path(__file__).parent / ".data"


@pytest.mark.parametrize(
"args, expected",
[
(
[
"--port",
"111",
"--uuid",
"fake-uuid",
"--testids",
"test_file.test_class.test_method",
],
(111, "fake-uuid", ["test_file.test_class.test_method"]),
),
(
["--port", "111", "--uuid", "fake-uuid", "--testids", ""],
(111, "fake-uuid", [""]),
),
(
[
"--port",
"111",
"--uuid",
"fake-uuid",
"--testids",
"test_file.test_class.test_method",
"-v",
"-s",
],
(111, "fake-uuid", ["test_file.test_class.test_method"]),
),
],
)
def test_parse_execution_cli_args(args: List[str], expected: List[str]) -> None:
"""The parse_execution_cli_args function should return values for the port, uuid, and testids arguments
when passed as command-line options, and ignore unrecognized arguments.
"""
actual = parse_execution_cli_args(args)
assert actual == expected


def test_no_ids_run() -> None:
"""This test runs on an empty array of test_ids, therefore it should return
an empty dict for the result.
"""
start_dir: str = os.fspath(TEST_DATA_PATH)
testids = []
pattern = "discovery_simple*"
actual = run_tests(start_dir, testids, pattern, None, "fake-uuid")
assert actual
assert all(item in actual for item in ("cwd", "status"))
assert actual["status"] == "success"
assert actual["cwd"] == os.fspath(TEST_DATA_PATH)
if "result" in actual:
assert len(actual["result"]) == 0
else:
raise AssertionError("actual['result'] is None")


def test_single_ids_run() -> None:
"""This test runs on a single test_id, therefore it should return
a dict with a single key-value pair for the result.
This single test passes so the outcome should be 'success'.
"""
id = "discovery_simple.DiscoverySimple.test_one"
actual = run_tests(
os.fspath(TEST_DATA_PATH), [id], "discovery_simple*", None, "fake-uuid"
)
assert actual
assert all(item in actual for item in ("cwd", "status"))
assert actual["status"] == "success"
assert actual["cwd"] == os.fspath(TEST_DATA_PATH)
assert "result" in actual
result = actual["result"]
assert len(result) == 1
assert id in result
id_result = result[id]
assert id_result is not None
assert "outcome" in id_result
assert id_result["outcome"] == "success"
4 changes: 2 additions & 2 deletions pythonFiles/unittestadapter/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ def run_tests(

if error is not None:
payload["error"] = error
else:
status = TestExecutionStatus.success

payload["status"] = status

# print(f"payload: \n{json.dumps(payload, indent=4)}")

return payload


Expand Down
6 changes: 5 additions & 1 deletion src/client/common/platform/fs-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ export class FileSystemPathUtils implements IFileSystemPathUtils {
}

export function normCasePath(filePath: string): string {
return getOSType() === OSType.Windows ? nodepath.normalize(filePath).toUpperCase() : nodepath.normalize(filePath);
return normCase(nodepath.normalize(filePath));
}

export function normCase(s: string): string {
return getOSType() === OSType.Windows ? s.toUpperCase() : s;
}

/**
Expand Down
Loading

0 comments on commit 9f67fbe

Please sign in to comment.