Skip to content

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

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

Merged
merged 3 commits into from
Feb 21, 2019

Conversation

ericsnowcurrently
Copy link
Member

(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)

@ericsnowcurrently ericsnowcurrently added the no-changelog No news entry required label Jan 29, 2019
@ericsnowcurrently ericsnowcurrently requested review from DonJayamanne and d3r3kk and removed request for DonJayamanne January 29, 2019 21:09
@d3r3kk
Copy link

d3r3kk commented Jan 29, 2019

Close/open to redo the CI

@d3r3kk d3r3kk closed this Jan 29, 2019
@d3r3kk d3r3kk reopened this Jan 29, 2019
@codecov
Copy link

codecov bot commented Jan 29, 2019

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% <ø> (?)

Copy link

@d3r3kk d3r3kk left a comment

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!

Copy link

@DonJayamanne DonJayamanne left a comment

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 @ericsnowcurrently were in the meeting.

sys.path.insert(1, DATASCIENCE_ROOT)
suite = unittest.defaultTestLoader.discover(TEST_ROOT,
top_level_dir=SRC_ROOT)
unittest.TextTestRunner(verbosity=2).run(suite)
Copy link

@DonJayamanne DonJayamanne Jan 29, 2019

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

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.

Copy link

@DonJayamanne DonJayamanne Jan 29, 2019

Choose a reason for hiding this comment

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

  • This was discussed with @brettcannon (@d3r3kk you too were in the meeting), and he recommended using pytest as it was the best.
  • and not a 3rd party tool.

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.

Copy link

@DonJayamanne DonJayamanne left a comment

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

Sorry, forgot to approve all good

Copy link

@DonJayamanne DonJayamanne left a comment

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 d3r3kk merged commit 57e8471 into microsoft:master Feb 21, 2019
@ericsnowcurrently ericsnowcurrently deleted the pythonTools-tests branch February 21, 2019 00:36
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants