question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running all tests in a test class raises an error

See original GitHub issue

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.6.0
  • OS and version: Win10
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): pipenv venv
  • Relevant/affected Python packages and their versions: XXX

Actual behavior

gif of issue being produced Issue occurs at about 40 seconds in. When attempting to run all tests within a specific test class, no tests are ran and an error is thrown; after the error is thrown, the green check tests passed bar seems to aggregate all past succesful runs of any tests instead of the current run. In this you’ll see that the test methods within the erroring test class will run, yet this is not always the functionality when this occurs, more often than not the same error notification will appear, yet within the console the test will indicate it has ran.

Expected behavior

Successful testing of all methods contained within a test class. Correct test count. No inexplicit error popup.

Steps to reproduce:

I’ve recreated the folder structure and files with minimal code and had the app_test.py behave similarly.

Logs

test_repr (tests.unit.blog_test.BlogTest) ... ok
test_repr_multiple_posts (tests.unit.blog_test.BlogTest) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.000s

OK
test_create_post_in_blog (tests.integration.blog_test.BlogTest) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
test_print_blogs (tests.system.app_test.AppTest) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
test_create_blog (tests.unit.blog_test.BlogTest) ... ok
test_repr (tests.unit.blog_test.BlogTest) ... ok
test_repr_multiple_posts (tests.unit.blog_test.BlogTest) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.000s

OK


dom.ts:179 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive.
console.ts:136 [Extension Host] Python Extension: Error: read ECONNRESET 
t.log @ console.ts:136
t._logExtensionHostMessage @ extensionHost.ts:393
(anonymous) @ extensionHost.ts:210
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
log.ts:171   ERR Unexpected end of JSON input: SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at Socket.socket.on (C:\Users\abelg\.vscode\extensions\ms-python.python-2018.6.0\out\client\unittests\unittest\socketServer.js:77:38)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at TCP.onread (net.js:560:20)
12console.ts:136 [Extension Host] Python Extension: Error: read ECONNRESET 
t.log @ console.ts:136
t._logExtensionHostMessage @ extensionHost.ts:393
(anonymous) @ extensionHost.ts:210
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
dom.ts:179 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive.
browser.ts:166 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14

github_iconTop GitHub Comments

2reactions
d3r3kkcommented, Jun 25, 2018

@DonJayamanne, I can reproduce this on Linux (Ubuntu 18.04) with the latest insiders build + latest production version of vscode-python extension.

I can look into it further and do some debugging…

1reaction
d3r3kkcommented, Jun 28, 2018

@abelgoodwin1988 I believe I found the root cause and corrected it with my change from yesterday. Thanks so much for the report & detailed reproduction data!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running testMethods: Could not run tests on class [ID]
If I attempt to re-run, it generally works, but one is consistently failing now.
Read more >
Why does testing a class method first cause other unit tests ...
The tests that fail are all meant to raise an error, but they all fail claiming the error was never raised. When these...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
If the setUp() method raises an exception while the test is running, the framework will consider the test to have suffered an error,...
Read more >
Could not run tests on class - Salesforce Stack Exchange
This is happening for me both on cs18 and cs17. Seemingly random changes allow the test classes to run. Actually they always run,...
Read more >
Test if a function throws an exception in Python - GeeksforGeeks
assertRaises () – It allows an exception to be encapsulated, meaning that the test can throw an exception without exiting the execution, as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found