Skip to content

Commit 99c203f

Browse files
committed
WIP: Adopt calls to work with tox v3 as well as v4
Due to setups with i.e. minversion=v4 in tox.ini, it may happen, that one is enforced to use this (although system install is still v3 ...). This should support both versions at all tox calls.
1 parent 17ed763 commit 99c203f

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"python",
77
"tox"
88
],
9-
"version": "1.0.0",
9+
"version": "1.0.1-dev",
1010
"license": "MIT",
1111
"publisher": "the-compiler",
1212
"repository": {

src/run.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { getTerminal } from './utils';
66

77
const exec = util.promisify(child_process.exec);
88

9-
export const commandToxListAllEnvs = 'tox -a';
9+
export const commandToxListAllEnvs = 'tox -a'; //for tox v4 may switch to
10+
//export const commandToxListAllEnvs = 'tox list --no-desc';
1011

1112
export async function getToxEnvs(projDir: string) {
1213
try {
@@ -34,13 +35,14 @@ export async function getToxEnvs(projDir: string) {
3435
return undefined;
3536
}
3637

37-
export const commandToxRun = 'tox -e';
38+
export const commandToxRun = 'tox -e'; //for tox v4 switch to
39+
//export const commandToxRun = 'tox run -e'; // does not work with a folder, needs to use --root/--workdir/..
3840

3941
export function runTox(envs: string[], toxArguments: string, terminal: vscode.Terminal = getTerminal() ) {
4042
const envArg = envs.join(",");
4143
terminal.show(true); // preserve focus
4244

43-
// FIXME In theory, there's a command injection here, if an environment name
45+
// FIXME: In theory, there's a command injection here, if an environment name
4446
// contains shell metacharacters. However:
4547
// - Escaping the argument in a shell-agnostic way is hard:
4648
// https://github.com/microsoft/vscode/blob/1.57.0/src/vs/workbench/contrib/debug/node/terminals.ts#L84-L211

src/testController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function create() {
3737

3838
const start = Date.now();
3939
try {
40-
const cwd = vscode.workspace.getWorkspaceFolder(test.uri!)!.uri.path;
40+
const cwd = "--workdir " + vscode.workspace.getWorkspaceFolder(test.uri!)!.uri.path + "/.tox";
4141
runTox([test.label], cwd);
4242
run.passed(test, Date.now() - start);
4343
}

0 commit comments

Comments
 (0)