Skip to content

Commit e6e03d5

Browse files
authored
Merge branch 'main' into far-hyena
2 parents e6e7366 + a9f6f22 commit e6e03d5

File tree

7 files changed

+25
-9
lines changed

7 files changed

+25
-9
lines changed

python_files/tests/pytestadapter/.data/coverage_w_config/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Licensed under the MIT License.
33

44
[tool.coverage.report]
5-
omit = ["test_ignore.py"]
5+
omit = ["test_ignore.py", "tests/*.py"]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
def test_i_hope_this_is_ignored():
5+
assert True

python_files/tests/pytestadapter/test_coverage.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,14 @@ def test_coverage_w_omit_config():
101101
│ ├── test_ignore.py
102102
│ ├── test_ran.py
103103
│ └── pyproject.toml
104+
│ ├── tests
105+
│ │ └── test_disregard.py
104106
105107
pyproject.toml file with the following content:
106108
[tool.coverage.report]
107109
omit = [
108110
"test_ignore.py",
111+
"tests/*.py" (this will ignore the coverage in the file tests/test_disregard.py)
109112
]
110113
111114

python_files/vscode_pytest/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,11 @@ def pytest_sessionfinish(session, exitstatus):
453453
# remove files omitted per coverage report config if any
454454
omit_files = cov.config.report_omit
455455
if omit_files:
456-
omit_files = set(omit_files)
457-
# convert to absolute paths, check against file set
458-
omit_files = {os.fspath(pathlib.Path(file).absolute()) for file in omit_files}
459-
print("Files to omit from reporting", omit_files)
460-
file_set = file_set - omit_files
456+
print("Plugin info[vscode-pytest]: Omit files/rules: ", omit_files)
457+
for pattern in omit_files:
458+
for file in list(file_set):
459+
if pathlib.Path(file).match(pattern):
460+
file_set.remove(file)
461461

462462
for file in file_set:
463463
try:

src/client/common/pipes/namedPipes.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { CancellationError, CancellationToken, Disposable } from 'vscode';
1212
import { traceVerbose } from '../../logging';
1313
import { isWindows } from '../utils/platform';
1414
import { createDeferred } from '../utils/async';
15+
import { noop } from '../utils/misc';
1516

1617
const { XDG_RUNTIME_DIR } = process.env;
1718
export function generateRandomPipeName(prefix: string): string {
@@ -187,6 +188,13 @@ export async function createReaderPipe(pipeName: string, token?: CancellationTok
187188
} catch {
188189
// Intentionally ignored
189190
}
190-
const reader = fs.createReadStream(pipeName, { encoding: 'utf-8' });
191-
return new rpc.StreamMessageReader(reader, 'utf-8');
191+
const fd = await fs.open(pipeName, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK);
192+
const socket = new net.Socket({ fd });
193+
const reader = new rpc.SocketMessageReader(socket, 'utf-8');
194+
socket.on('close', () => {
195+
fs.close(fd).catch(noop);
196+
reader.dispose();
197+
});
198+
199+
return reader;
192200
}

src/client/repl/replController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export function createReplController(
1111

1212
const controller = vscode.notebooks.createNotebookController('pythonREPL', 'jupyter-notebook', 'Python REPL');
1313
controller.supportedLanguages = ['python'];
14-
controller.supportsExecutionOrder = true;
1514

1615
controller.description = 'Python REPL';
1716

src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export class PytestTestDiscoveryAdapter implements ITestDiscoveryAdapter {
127127
traceError(
128128
`Subprocess exited unsuccessfully with exit code ${code} and signal ${signal} on workspace ${uri.fsPath}`,
129129
);
130+
this.resultResolver?.resolveDiscovery(createDiscoveryErrorPayload(code, signal, cwd));
130131
}
131132
deferredTillExecClose.resolve();
132133
});

0 commit comments

Comments
 (0)