add python.testing.cwd to pytest discovery if present (#24384)
fixes https://github.com/microsoft/vscode-python/issues/9553
This commit is contained in:
Родитель
379229aa4c
Коммит
622653efd8
|
@ -84,6 +84,9 @@ export class PytestTestDiscoveryAdapter implements ITestDiscoveryAdapter {
|
|||
traceWarn("Symlink found, adding '--rootdir' to pytestArgs only if it doesn't already exist. cwd: ", cwd);
|
||||
pytestArgs = addValueIfKeyNotExist(pytestArgs, '--rootdir', cwd);
|
||||
}
|
||||
// if user has provided `--rootdir` then use that, otherwise add `cwd`
|
||||
// root dir is required so pytest can find the relative paths and for symlinks
|
||||
addValueIfKeyNotExist(pytestArgs, '--rootdir', cwd);
|
||||
|
||||
// get and edit env vars
|
||||
const mutableEnv = {
|
||||
|
|
|
@ -179,7 +179,17 @@ suite('pytest test discovery adapter', () => {
|
|||
|
||||
// verification
|
||||
|
||||
const expectedArgs = ['-m', 'pytest', '-p', 'vscode_pytest', '--collect-only', '.', 'abc', 'xyz'];
|
||||
const expectedArgs = [
|
||||
'-m',
|
||||
'pytest',
|
||||
'-p',
|
||||
'vscode_pytest',
|
||||
'--collect-only',
|
||||
'.',
|
||||
'abc',
|
||||
'xyz',
|
||||
`--rootdir=${expectedPathNew}`,
|
||||
];
|
||||
execService.verify(
|
||||
(x) =>
|
||||
x.execObservable(
|
||||
|
|
Загрузка…
Ссылка в новой задаче