Skip to content

Conversation

@d3r3kk
Copy link

@d3r3kk d3r3kk commented Aug 13, 2018

Fixes #2143, unit test counts in the VSCode status bar are not reflecting correct quantities.

  • Title summarizes what is changing
  • Includes a news entry file (remember to thank yourself!)
  • Unit tests & code coverage are not adversely affected (within reason)
  • Works on all actively maintained versions of Python (e.g. Python 2.7 & the latest Python 3 release)
  • Works on Windows 10, macOS, and Linux (e.g. considered file system case-sensitivity)
  • Added unit tests that test for improper counts being reported to the user.

@codecov
Copy link

codecov bot commented Aug 13, 2018

Codecov Report

Merging #2383 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2383      +/-   ##
==========================================
+ Coverage   75.38%   75.39%   +<.01%     
==========================================
  Files         309      309              
  Lines       14331    14332       +1     
  Branches     2537     2537              
==========================================
+ Hits        10804    10806       +2     
+ Misses       3518     3517       -1     
  Partials        9        9
Flag Coverage Δ
#MacOS 74.21% <100%> (ø) ⬆️
#Windows 74.3% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/client/unittests/common/types.ts 100% <ø> (ø) ⬆️
src/client/unittests/unittest/runner.ts 95.95% <100%> (+0.04%) ⬆️
...nt/unittests/common/services/testResultsService.ts 92.85% <100%> (ø) ⬆️
src/client/unittests/unittest/helper.ts 85.71% <0%> (+3.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6707eaa...b00410e. Read the comment docs.

@d3r3kk d3r3kk changed the title [WIP] Ensure EventListeners for unittest test results are not registered multiple times Ensure EventListeners for unittest test results are not registered multiple times Aug 14, 2018
@d3r3kk
Copy link
Author

d3r3kk commented Aug 14, 2018

I attempted to correct how I'm registering the callbacks to limit the number of times we need to register/unregister, but I've not been successful.

If I register each time we run tests, then unregister, it solves the problem. This is the solution I'm proposing with this PR.

Ideally though, I'd want to simply register the events once in the constructor (or alternatively, in a single-shot 'register once then skip subsequent registrations' method). And never unregister my event handlers for the duration of the execution of the extension. This seems simpler to me.

However, I haven't been able to successfully register once and have it work, I am 100% open to suggestions as I think my ideal solution would be simpler!

@@ -1,13 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a new file, so don't add the copyright header.

});

this.server.on('socket.disconnected', (socket: Socket, isSocketDestroyed: boolean) => {
this.server.removeAllListeners('error');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a list of all the possible values to make sure this doesn't skew in the future if more options come up?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I can improve upon this and just remove all event listeners altogether. I'll do that as it seems more forward-thinking.

d3r3kk and others added 8 commits August 20, 2018 14:39
Fixes microsoft#2143

- Unregister listeners from socket service after each test run
- Update related code files to correct for linter errors

- Add (commented out) unit test method

- Create Python test files for test count issues
- NOTE: 2x test works, (3+N)x does not.
  - Perhaps a timeout issue, but might be worse
  - Will try a different solution  to see if I can get this sorted.
Not a new file.
- allow for not specifying the specific event listener to remove
@d3r3kk d3r3kk merged commit a4d8846 into microsoft:master Aug 21, 2018
@d3r3kk d3r3kk deleted the issue2143 branch August 21, 2018 00:39
@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test run results in status bar reporting incorrect count

2 participants