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

Be able to disable automatic test discovery on save #1037

Closed
amittleider opened this issue Mar 12, 2018 · 2 comments · Fixed by #1687
Closed

Be able to disable automatic test discovery on save #1037

amittleider opened this issue Mar 12, 2018 · 2 comments · Fixed by #1687
Labels
area-testing feature-request Request for new features or functionality good first issue

Comments

@amittleider
Copy link

amittleider commented Mar 12, 2018

Environment data

  • VS Code version:
Version 1.20.1
Commit f88bbf9137d24d36d968ea6b2911786bfe103002
Date 2018-02-13T15:31:21.019Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
  • Extension version (available under the Extensions sidebar): `2018.2.1

  • OS and version:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial
  • Python version: Python 3.6.3
  • Type of virtual environment used (if applicable): venv

Steps to reproduce:

  1. Launch VS code with a python environment configured
  2. Make a test file and run it using the command Python: Run Current Unit Test file in the vscode command console. This will run the test discovery first and then launch your unit tests.
  3. Make a minor change to your unit test file and save it.
  4. Notice that the test discovery runs again, even though you never added a test.

Behavior/suggestion

Unit tests are discovered through nosetests whenever a test file is saved. This triggers a process that takes about 4 seconds for me. Since the tests must be discovered before they can be run, this makes it time consuming to make small changes to a test file.

One suggestion would be to have the option to disable the test discovery when a file is saved, and have an optional command to manually discover unit tests.

It's possible this behavior is coming from src/client/unittests/main.ts:onDocumentSaved, line 69 const tests = await testManager.discoverTests(CommandSource.auto, false, true);

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

This is from the Python Test Logs window:

image

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
This is probably irrelevant but I'll put it anyways

/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:253 [Extension Host] [IPC Library: Search] (node:7983) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:253
mainThreadExtensionService.ts:43 [njpwerner.autodocstring]Cannot read property 'rangeLength' of undefined
e.$onExtensionRuntimeError @ mainThreadExtensionService.ts:43
e._doInvokeHandler @ rpcProtocol.ts:174
e._invokeHandler @ rpcProtocol.ts:159
e._receiveRequest @ rpcProtocol.ts:108
e._receiveOneMessage @ rpcProtocol.ts:90
(anonymous) @ rpcProtocol.ts:33
(anonymous) @ rpcProtocol.ts:213
e.fire @ event.ts:142
(anonymous) @ ipc.net.ts:81
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
mainThreadExtensionService.ts:44 TypeError: Cannot read property 'rangeLength' of undefined
	at activateOnEnter (/home/andrew/.vscode/extensions/njpwerner.autodocstring-0.2.0/out/src/extension.js:21:38)
	at context.subscriptions.push.vs.workspace.onDidChangeTextDocument.changeEvent (/home/andrew/.vscode/extensions/njpwerner.autodocstring-0.2.0/out/src/extension.js:13:90)
	at e.fire (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:88:729)
	at e.$acceptDirtyStateChanged (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:623:1010)
	at e._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:584:983)
	at e._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:584:701)
	at e._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:583:836)
	at e._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:583:605)
	at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:582:671
	at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:585:523
e.$onExtensionRuntimeError @ mainThreadExtensionService.ts:44
e._doInvokeHandler @ rpcProtocol.ts:174
e._invokeHandler @ rpcProtocol.ts:159
e._receiveRequest @ rpcProtocol.ts:108
e._receiveOneMessage @ rpcProtocol.ts:90
(anonymous) @ rpcProtocol.ts:33
(anonymous) @ rpcProtocol.ts:213
e.fire @ event.ts:142
(anonymous) @ ipc.net.ts:81
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
mainThreadExtensionService.ts:43 [njpwerner.autodocstring]Cannot read property 'rangeLength' of undefined
e.$onExtensionRuntimeError @ mainThreadExtensionService.ts:43
e._doInvokeHandler @ rpcProtocol.ts:174
e._invokeHandler @ rpcProtocol.ts:159
e._receiveRequest @ rpcProtocol.ts:108
e._receiveOneMessage @ rpcProtocol.ts:90
(anonymous) @ rpcProtocol.ts:33
(anonymous) @ rpcProtocol.ts:213
e.fire @ event.ts:142
(anonymous) @ ipc.net.ts:81
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
mainThreadExtensionService.ts:44 TypeError: Cannot read property 'rangeLength' of undefined
	at activateOnEnter (/home/andrew/.vscode/extensions/njpwerner.autodocstring-0.2.0/out/src/extension.js:21:38)
	at context.subscriptions.push.vs.workspace.onDidChangeTextDocument.changeEvent (/home/andrew/.vscode/extensions/njpwerner.autodocstring-0.2.0/out/src/extension.js:13:90)
	at e.fire (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:88:729)
	at e.$acceptDirtyStateChanged (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:623:1010)
	at e.$acceptModelSaved (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:623:793)
	at e._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:584:983)
	at e._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:584:701)
	at e._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:583:836)
	at e._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:583:605)
	at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:582:671
e.$onExtensionRuntimeError @ mainThreadExtensionService.ts:44
e._doInvokeHandler @ rpcProtocol.ts:174
e._invokeHandler @ rpcProtocol.ts:159
e._receiveRequest @ rpcProtocol.ts:108
e._receiveOneMessage @ rpcProtocol.ts:90
(anonymous) @ rpcProtocol.ts:33
(anonymous) @ rpcProtocol.ts:213
e.fire @ event.ts:142
(anonymous) @ ipc.net.ts:81
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
console.ts:123 [Extension Host] (node:7844) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ console.ts:123
t._logExtensionHostMessage @ extensionHost.ts:394
(anonymous) @ extensionHost.ts:211
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104
console.ts:123 [IPC Library: Search] (node:8278) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
t.log @ console.ts:123
(anonymous) @ ipc.cp.ts:157
e.fire @ event.ts:142
i @ event.ts:532
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104
6TMSyntax.ts:384 Line (nose.plugins.co...): longer than 20k characters, tokenization skipped.
@DonJayamanne DonJayamanne added this to the March 2018 milestone Mar 12, 2018
@brettcannon brettcannon removed this from the March 2018 milestone Mar 12, 2018
@brettcannon brettcannon changed the title Nose test discovery runs unnecessarily Be able to disable automatic test discovery on save Jun 11, 2018
@amittleider
Copy link
Author

Installed the latest build today to get this feature. Thanks guys.

@baruchiro
Copy link

I use version 1.3.7, and don't see an option in vscode to cancel the automatic test discovery on save.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing feature-request Request for new features or functionality good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants