Skip to content

Set up tests for the extension's Python files. - #4208

Merged
Derek Keeler (d3r3kk) merged 3 commits into
microsoft:masterfrom
ericsnowcurrently:pythonTools-tests
Feb 21, 2019
Merged

Derek Keeler (d3r3kk) merged 3 commits into
microsoft:masterfrom
ericsnowcurrently:pythonTools-tests

Conversation

@ericsnowcurrently

Copy link
Copy Markdown

(for #4033)

This is a dependency of a follow-up PR that will add a testing tool adapter for pytest.

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • [ ] Has a news entry file (remember to thank yourself!)
  • [ ] Has sufficient logging.
  • [ ] Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated
  • [ ] Test plan is updated as appropriate
  • [ ] package-lock.json has been regenerated by running npm install (if dependencies have changed)
@d3r3kk

Copy link
Copy Markdown

Close/open to redo the CI

@codecov

codecov Bot commented Jan 29, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #4208 into master will increase coverage by 20%.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           master   #4208     +/-   ##
========================================
+ Coverage      58%     78%    +20%     
========================================
  Files         363     439     +76     
  Lines       15612   20664   +5052     
  Branches     2428    3314    +886     
========================================
+ Hits         8948   15958   +7010     
+ Misses       6084    4701   -1383     
+ Partials      580       5    -575
Flag Coverage Δ
#Linux 65% <ø> (?)
#Windows 66% <ø> (?)

@d3r3kk Derek Keeler (d3r3kk) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This begins the path to testing our Python scripts!

@DonJayamanne Don Jayamanne (DonJayamanne) left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please can we use pytest. Some time ago we all decided that we'd use pytest.
Not sure whether you Eric Snow (@ericsnowcurrently) were in the meeting.

Comment thread pythonFiles/tests/__main__.py Outdated
sys.path.insert(1, DATASCIENCE_ROOT)
suite = unittest.defaultTestLoader.discover(TEST_ROOT,
top_level_dir=SRC_ROOT)
unittest.TextTestRunner(verbosity=2).run(suite)

@DonJayamanne Don Jayamanne (DonJayamanne) Jan 29, 2019 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just out of curiosity, why can't we just put tests in a directory and just run run the tests directly using the CLI, without having to create such files! Feels unnecessary.
Either way, pytest should take care of this.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think the point here was to simply use stdlib and not a 3rd party tool.

@DonJayamanne Don Jayamanne (DonJayamanne) Jan 29, 2019 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We're already installing a tonne of 3rd party tools... E.g. for TPN, etc... i.e. no escaping installing 3rd party tools for development.

  • Also, I'm not a fan of main.py magic, can't we use simple CLI for running tests, rather than hardcoding stuff in here.
    I'm not saying this is wrong, but this feels too low level.

@DonJayamanne Don Jayamanne (DonJayamanne) left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please look at the tests in tpn

  • We are already using pytest
  • No __main__.py file with initialization (lets do that via cli).
@DonJayamanne

Copy link
Copy Markdown

Sorry, forgot to approve all good

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry, forgot to approve all good

@d3r3kk
Derek Keeler (d3r3kk) merged commit 57e8471 into microsoft:master Feb 21, 2019
@ericsnowcurrently
Eric Snow (ericsnowcurrently) deleted the pythonTools-tests branch February 21, 2019 00:36
Don Jayamanne (DonJayamanne) pushed a commit that referenced this pull request Mar 5, 2019
(for #4033-ish)

This is a fix to #4208 and #4605 which makes sure `pythonFiles/tests` (and `pythonFiles/testing_tools`) works under Python 2.7.
@lock lock Bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog No news entry required

3 participants