Skip to content

Conversation

d3r3kk
Copy link

@d3r3kk d3r3kk commented Jul 23, 2018

  • change the download version to latest build
  • change the name of the executable bit of the LS

Fixes #2233

  • Title summarizes what is changing
  • Unnecessary. 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)
  • Dependencies are pinned (e.g. "1.2.3", not "^1.2.3")
  • package-lock.json has been regenerated if dependencies have changed

- change the download version to latest build
- change the name of the executable bit of the LS
- Remove hardcoded strings causing issues
- Expose information from downloader/platform
- Update tests for explicit OS types
@codecov
Copy link

codecov bot commented Jul 23, 2018

Codecov Report

Merging #2234 into master will decrease coverage by 0.02%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2234      +/-   ##
==========================================
- Coverage   79.84%   79.82%   -0.03%     
==========================================
  Files         310      310              
  Lines       14359    14367       +8     
  Branches     2547     2549       +2     
==========================================
+ Hits        11465    11468       +3     
- Misses       2882     2887       +5     
  Partials       12       12
Flag Coverage Δ
#MacOS 73.97% <92.85%> (+0.01%) ⬆️
#Windows 74.11% <92.85%> (ø) ⬆️
Impacted Files Coverage Δ
src/client/activation/downloader.ts 35.36% <100%> (ø) ⬆️
src/client/interpreter/interpreterVersion.ts 95.23% <100%> (ø) ⬆️
src/client/activation/platformData.ts 85% <90.9%> (+0.62%) ⬆️
src/client/unittests/display/main.ts 88.28% <0%> (-3.13%) ⬇️
...rc/client/debugger/PythonProcessCallbackHandler.ts 68.42% <0%> (-0.33%) ⬇️
src/client/providers/jediProxy.ts 79.95% <0%> (+0.22%) ⬆️

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 6af8f99...7549082. Read the comment docs.

@d3r3kk
Copy link
Author

d3r3kk commented Jul 23, 2018

VSTS broke - macOS agents have 3.7 installed instead of 3.6 now.

@d3r3kk d3r3kk closed this Jul 23, 2018
@d3r3kk d3r3kk reopened this Jul 23, 2018
- make it allow 2, or 3, version segments
- handles old M.m.r or new Y.r version patterns
const downloadBaseFileName = 'Python-Language-Server';
const downloadVersion = '0.1.0';
const downloadFileExtension = '.nupkg';
export const downloadUriPrefix = 'https://pvsc.blob.core.windows.net/python-language-server';
Copy link

@DonJayamanne DonJayamanne Jul 23, 2018

Choose a reason for hiding this comment

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

Please do not export. This is not a valid way of testing.
E.g. if you have a typo or wrong version in here, then when testing you're not testing against expected values.

When writing the test, we should be testing the results against some expected values. Not against the result itself.
I.e. you need to confirm the right version and file is being downloaded.

However if we use the same constant for the test and the code, then we'll never catch any bugs/typos. It'll always pass, i.e. the test does not serve a purpose.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, but I'm also just as likely to copy and paste between the code and the test, so I don't see this as really protecting you from anything other than adding overhead in tests when these values change.

What Derek should (and soon will) be doing is exporting the object containing the final URLs.

Copy link

@DonJayamanne DonJayamanne Jul 23, 2018

Choose a reason for hiding this comment

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

just as likely to copy and paste between the code and the test

That's always likely to happen in any test.

from anything other than adding overhead in tests when these values change.

But then what's the value of the test.
Isn't this similar to testing a function sum that adds two numbers, and then using the same exported code to validate the sum of a + b. I.e. we should validate the logic by performing the same operation in the test, not by re-importing the same code.

Or a better example is calculation of a hash, we wouldn't re-import the same library to validate the hash. Instead we'd either use some pre-calculated hash in the test.

import * as assert from 'assert';
import * as TypeMoq from 'typemoq';
import { LanguageServerDownloader } from '../../client/activation/downloader';
import { downloadBaseFileName, downloadFileExtension, downloadUriPrefix, downloadVersion, LanguageServerDownloader } from '../../client/activation/downloader';

Choose a reason for hiding this comment

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

Please do not import, leave the values back the way it was. Else its not a valid test.
I.e. if we fail to change version or file extension, tests will never catch it.

@brettcannon brettcannon merged commit e56fb1c into microsoft:master Jul 24, 2018
@d3r3kk d3r3kk deleted the langservupdate branch July 24, 2018 01:10
bschley pushed a commit to bschley/vscode-python that referenced this pull request Aug 2, 2018
* Update to latest Language Server

- change the download version to latest build
- change the name of the executable bit of the LS

* Fix unit tests

- Remove hardcoded strings causing issues
- Expose information from downloader/platform
- Update tests for explicit OS types

* Update PIP version regex

- make it allow 2, or 3, version segments
- handles old M.m.r or new Y.r version patterns

* Remove hard-coded strings /and/ formats from tests.

* Correction to the PIP_VERSION_REGEX

- keep it simple, keeler.
@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.

Update LanguageServer download version to latest

3 participants