Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct discovery on unittest skip at file level #21665

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
correct discovery on unittest skip at file level
  • Loading branch information
eleanorjboyd committed Jul 19, 2023
commit 3fe17ce2c905d1d117f1e528014a7ae31ef4704b
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

from unittest import SkipTest

raise SkipTest("This is unittest.SkipTest calling")


def test_example():
assert 1 == 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import unittest


def add(x, y):
return x + y


class SimpleTest(unittest.TestCase):
@unittest.skip("demonstrating skipping")
def testadd1(self):
self.assertEquals(add(4, 5), 9)


if __name__ == "__main__":
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import os
from unittestadapter.utils import TestNodeTypeEnum
from .helpers import TEST_DATA_PATH

skip_unittest_folder_discovery_output = {
"path": os.fspath(TEST_DATA_PATH / "unittest_skip"),
"name": "unittest_skip",
"type_": TestNodeTypeEnum.folder,
"children": [
{
"path": os.fspath(
TEST_DATA_PATH / "unittest_skip" / "unittest_skip_file.py"
),
"name": "unittest_skip_file.py",
"type_": TestNodeTypeEnum.file,
"children": [],
"id_": os.fspath(
TEST_DATA_PATH / "unittest_skip" / "unittest_skip_file.py"
),
},
{
"path": os.fspath(
TEST_DATA_PATH / "unittest_skip" / "unittest_skip_function.py"
),
"name": "unittest_skip_function.py",
"type_": TestNodeTypeEnum.file,
"children": [
{
"path": os.fspath(
TEST_DATA_PATH / "unittest_skip" / "unittest_skip_function.py"
),
"name": "SimpleTest",
"type_": TestNodeTypeEnum.class_,
"children": [
{
"name": "testadd1",
"path": os.fspath(
TEST_DATA_PATH
/ "unittest_skip"
/ "unittest_skip_function.py"
),
"lineno": "13",
"type_": TestNodeTypeEnum.test,
"id_": os.fspath(
TEST_DATA_PATH
/ "unittest_skip"
/ "unittest_skip_function.py"
)
+ "\\SimpleTest\\testadd1",
"runID": "unittest_skip_function.SimpleTest.testadd1",
}
],
"id_": os.fspath(
TEST_DATA_PATH / "unittest_skip" / "unittest_skip_function.py"
)
+ "\\SimpleTest",
}
],
"id_": os.fspath(
TEST_DATA_PATH / "unittest_skip" / "unittest_skip_function.py"
),
},
],
"id_": os.fspath(TEST_DATA_PATH / "unittest_skip"),
}
Loading
Loading