Skip to content
Open
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
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,7 @@
"type": "string"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Non-blocking recommendation

Clearing these arguments changes the effective discovery pattern from *test*.py to unittest's native test*.py. Projects that relied on suffix-named files such as example_test.py being discovered with the extension defaults will stop finding them. Please add regression coverage for this compatibility decision, or preserve the previous behavior if the narrower pattern is not intended.

},
"python.testing.unittestArgs": {
"default": [
"-v",
"-s",
".",
"-p",
"*test*.py"
],
"default": [],
"description": "%python.testing.unittestArgs.description%",
"items": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion src/test/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": false,
"python.testing.pytestArgs": [],
"python.testing.unittestArgs": ["-s=./tests", "-p=test_*.py", "-v", "-s", ".", "-p", "*test*.py"],
"python.testing.unittestArgs": [],
"python.linting.lintOnSave": false,
"python.linting.enabled": true,
"python.linting.pycodestyleEnabled": false,
Expand Down
12 changes: 6 additions & 6 deletions src/test/testing/common/testingAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ suite('End to End Tests: test adapters', () => {

// set workspace to test workspace folder and set up settings

configService.getSettings(workspaceUri).testing.unittestArgs = ['-s', '.', '-p', '*test*.py'];
configService.getSettings(workspaceUri).testing.unittestArgs = [];

// run unittest discovery
const discoveryAdapter = new UnittestTestDiscoveryAdapter(configService, resultResolver, envVarsService);
Expand Down Expand Up @@ -210,7 +210,7 @@ suite('End to End Tests: test adapters', () => {

// set settings to work for the given workspace
workspaceUri = Uri.parse(rootPathLargeWorkspace);
configService.getSettings(workspaceUri).testing.unittestArgs = ['-s', '.', '-p', '*test*.py'];
configService.getSettings(workspaceUri).testing.unittestArgs = [];
// run discovery
const discoveryAdapter = new UnittestTestDiscoveryAdapter(configService, resultResolver, envVarsService);

Expand Down Expand Up @@ -486,7 +486,7 @@ suite('End to End Tests: test adapters', () => {

// set workspace to test workspace folder
workspaceUri = Uri.parse(rootPathSmallWorkspace);
configService.getSettings(workspaceUri).testing.unittestArgs = ['-s', '.', '-p', '*test*.py'];
configService.getSettings(workspaceUri).testing.unittestArgs = [];
// run execution
const executionAdapter = new UnittestTestExecutionAdapter(configService, resultResolver, envVarsService);
const testRun = typeMoq.Mock.ofType<TestRun>();
Expand Down Expand Up @@ -563,7 +563,7 @@ suite('End to End Tests: test adapters', () => {

// set workspace to test workspace folder
workspaceUri = Uri.parse(rootPathLargeWorkspace);
configService.getSettings(workspaceUri).testing.unittestArgs = ['-s', '.', '-p', '*test*.py'];
configService.getSettings(workspaceUri).testing.unittestArgs = [];

// run unittest execution
const executionAdapter = new UnittestTestExecutionAdapter(configService, resultResolver, envVarsService);
Expand Down Expand Up @@ -711,7 +711,7 @@ suite('End to End Tests: test adapters', () => {

// set workspace to test workspace folder
workspaceUri = Uri.parse(rootPathCoverageWorkspace);
configService.getSettings(workspaceUri).testing.unittestArgs = ['-s', '.', '-p', '*test*.py'];
configService.getSettings(workspaceUri).testing.unittestArgs = [];
// run execution
const executionAdapter = new UnittestTestExecutionAdapter(configService, resultResolver, envVarsService);
const testRun = typeMoq.Mock.ofType<TestRun>();
Expand Down Expand Up @@ -895,7 +895,7 @@ suite('End to End Tests: test adapters', () => {

// set workspace to test workspace folder
workspaceUri = Uri.parse(rootPathDiscoveryErrorWorkspace);
configService.getSettings(workspaceUri).testing.unittestArgs = ['-s', '.', '-p', '*test*.py'];
configService.getSettings(workspaceUri).testing.unittestArgs = [];

const discoveryAdapter = new UnittestTestDiscoveryAdapter(configService, resultResolver, envVarsService);
const testRun = typeMoq.Mock.ofType<TestRun>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ suite('Execution Flow Run Adapters', () => {
myTestPath = path.join('/', 'my', 'test', 'path', '/');
configService = ({
getSettings: () => ({
testing: { pytestArgs: ['.'], unittestArgs: ['-v', '-s', '.', '-p', 'test*'] },
testing: { pytestArgs: ['.'], unittestArgs: [] },
}),
isTestExecution: () => false,
} as unknown) as IConfigurationService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ suite('Unittest test discovery adapter', () => {
expectedPath = path.join('/', 'new', 'cwd');
configService = ({
getSettings: () => ({
testing: { unittestArgs: ['-v', '-s', '.', '-p', 'test*'] },
testing: { unittestArgs: [] },
}),
} as unknown) as IConfigurationService;

Expand Down Expand Up @@ -96,7 +96,7 @@ suite('Unittest test discovery adapter', () => {
const adapter = new UnittestTestDiscoveryAdapter(configService);
adapter.discoverTests(uri, execFactory.object);
const script = path.join(EXTENSION_ROOT_DIR, 'python_files', 'unittestadapter', 'discovery.py');
const argsExpected = [script, '--udiscovery', '-v', '-s', '.', '-p', 'test*'];
const argsExpected = [script, '--udiscovery'];

// must await until the execObservable is called in order to verify it
await deferred.promise;
Expand Down Expand Up @@ -133,13 +133,13 @@ suite('Unittest test discovery adapter', () => {
const expectedNewPath = path.join('/', 'new', 'cwd');
configService = ({
getSettings: () => ({
testing: { unittestArgs: ['-v', '-s', '.', '-p', 'test*'], cwd: expectedNewPath.toString() },
testing: { unittestArgs: [], cwd: expectedNewPath.toString() },
}),
} as unknown) as IConfigurationService;
const adapter = new UnittestTestDiscoveryAdapter(configService);
adapter.discoverTests(uri, execFactory.object);
const script = path.join(EXTENSION_ROOT_DIR, 'python_files', 'unittestadapter', 'discovery.py');
const argsExpected = [script, '--udiscovery', '-v', '-s', '.', '-p', 'test*'];
const argsExpected = [script, '--udiscovery'];

// must await until the execObservable is called in order to verify it
await deferred.promise;
Expand Down Expand Up @@ -258,7 +258,7 @@ suite('Unittest test discovery adapter', () => {
const adapter = new UnittestTestDiscoveryAdapter(configService);
adapter.discoverTests(uri, execFactory.object, undefined, undefined, mockProject);
const script = path.join(EXTENSION_ROOT_DIR, 'python_files', 'unittestadapter', 'discovery.py');
const argsExpected = [script, '--udiscovery', '-v', '-s', '.', '-p', 'test*'];
const argsExpected = [script, '--udiscovery'];

// must await until the execObservable is called in order to verify it
await deferred.promise;
Expand Down Expand Up @@ -301,7 +301,7 @@ suite('Unittest test discovery adapter', () => {
const adapter = new UnittestTestDiscoveryAdapter(configService);
adapter.discoverTests(uri, execFactory.object);
const script = path.join(EXTENSION_ROOT_DIR, 'python_files', 'unittestadapter', 'discovery.py');
const argsExpected = [script, '--udiscovery', '-v', '-s', '.', '-p', 'test*'];
const argsExpected = [script, '--udiscovery'];

// must await until the execObservable is called in order to verify it
await deferred.promise;
Expand Down