Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks integration: Failing tests? #26

Closed
The-Compiler opened this issue Jul 6, 2022 · 3 comments
Closed

Tasks integration: Failing tests? #26

The-Compiler opened this issue Jul 6, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@The-Compiler
Copy link
Owner

The-Compiler commented Jul 6, 2022

Tests seem to fail after merging the tasks integration: https://github.com/The-Compiler/vscode-python-tox/runs/7218607915?check_suite_focus=true

  1) ToxTaskProvider Test Suite
       getting tox tasks:
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
0 !== 3
+ expected- actual
-0
+3

not sure what's going on there? I saw this error once locally, but when rerunning it went away, so I didn't think much of it...

@dariuszparys do you have any idea what could be going on there?

(follow-up to #5/#12)

@The-Compiler The-Compiler added the bug Something isn't working label Jul 6, 2022
@The-Compiler
Copy link
Owner Author

After 2 hours of debugging I think I finally got to the bottom of this and figured out how to make those tests run 😅

So the problem is that it's not possible to enter a new workspace in tests, because VS Code restarts the extension host when that's done, and thus outright refuses to do so when running tests:

When running the tests for the first time, that's confirmed by an error:

Extension 'python-tox' failed to update workspace folders: Error: Entering a new workspace is not possible in tests.

Triggered from here:

vscode.workspace.updateWorkspaceFolders(0, null, allEnvsWorkspaceFolder);

And indeed the tests fail because the task runner can't find any workspace - vscode.workspace.workspaceFolders is empty here:

if (!workspaceFolders || workspaceFolders.length === 0) {
return result;
}

However, the workspace state seems to get stored in .vscode-test/ despite the error! Thus, when launching the tests a second time, they just happen to open allenvs as a workspace and everything works, until .vscode-test/ is deleted again... Of course, the CI always starts with a clean state, which is why they probably always passed for @dariuszparys locally, but always fail on the CI. To top it all off, apparently I never ever enabled CI for PRs and didn't even notice until now... 🤭

In 46ecf1f, I now ended up changing runTest.js to open all examples as folders in a multi-folder workspace - with that setup, everything works again. Not perfect since it means tests aren't isolated as nicely from each other anymore, but better than nothing I guess...

The-Compiler added a commit that referenced this issue Jul 7, 2022
Due to VS Code limitations, we need to run VS Code in a workspace with
all examples available. Thus, we can't know exactly how many envs we
are going to get here.

See #26
@dariuszparys
Copy link

Thanks @The-Compiler for fixing, totally oversaw this, I'm just curious why my merge was successful with the CI in place, I assume that the CI triggered before the merge can happen should have caught that, right?

@The-Compiler
Copy link
Owner Author

Indeed it should have - but the CI actually didn't run on pull requests at all, because I had an indentation error in the job definition 😊 f7791a2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants