forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-testingdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.Covers everything internal: CI, testing, refactoring of the codebase, etc.
Milestone
Description
(related to #3911)
- add Python script to with basic CLI to handle pytest discovery
- call pytest API to do discovery
- serialize (JSON) results into minimal data structure
- write to stdout
- plug into extension code (ts) (see Refactor pytest discovery code in extension to use python #4035)
Proposed Minimal Output Format
[
testRoot: string;
folders: [
{
name: string; // folderName relative to `testRoot`.
package?: [
{
fileName: // test file name
testSuite?: [
{
name: string; // name of test suite
lineNumber: number; // line number suite definition exists on (1-based)
parentTestSuite?: string[] // if this is a suite within another suite, the immedate parent
functions: [
{
name: string; // name of test function
lineNumber: number; // line number function exists on (1-based)
}
];
}
]
functions?: [
{
// see definition of `testSuite:functions` above
}
]
errors: string[]; // any errors found when discovering this specific package
}
]
}
]
]
current pytest output:
# python -m pytest --collect-only -q
test_foo.py::test_a
test_foo.py::test_b
sub_a/sub_b/test_sub_b.py::TestFooSub2::test_value_below_one_hundred
sub_a/sub_b/test_sub_b.py::TestFooSub2::test_value_above_zero
sub_a/sub_b/sub_c/test_sub_c.py::test_something_odd
sub_a/sub_b/sub_c/test_sub_c.py::TestSomethingSomething::test_something_even
testsub/test_foo_sub1.py::TestFooSub1::test_foo_sub1_method1
testsub/test_foo_sub1.py::TestFooSub1::test_foo_sub1_method2
testsub/test_foo_sub1.py::TestFooSub1::TstFooSub1_A::test_foo_sub1_method2
serialized:
{
testRoot: "/home/user/dev/workspace",
folders: [
{
name: ".",
testFiles: [
{
fileName: "test_foo.py",
functions: [
{
name: "test_a",
id: "test_foo.py::test_a"
},
{
name: "test_b",
id: "test_foo.py::test_b"
}
]
}
]
},
{
name: "testsub",
testFiles: [
{
fileName: "test_foo_sub1.py",
}
]
}
]
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-testingdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.Covers everything internal: CI, testing, refactoring of the codebase, etc.