Skip to content

Conversation

@d3r3kk
Copy link

@d3r3kk d3r3kk commented Mar 9, 2019

For #4035

Transform results from our new Python test adapter for discovery into the Tests struct we use throughout the extension.


  • 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)
  • The wiki is updated with any design decisions/details.

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.

I think the python API needa to be re-visited.
We are still parsing strings and building a tree, in the TS layer to build and identify parent child relationships.
This needs to be done in the Python layer where the entire structure of known and prescribed, i.e. it should simply return a strongly typed json structure = a tree, making it totally unnecessary to build a tree/parse again in TS.

/cc @ericsnowcurrently

@codecov
Copy link

codecov bot commented Mar 11, 2019

Codecov Report

Merging #4695 into master will decrease coverage by 16%.
The diff coverage is 76%.

@@           Coverage Diff            @@
##           master   #4695     +/-   ##
========================================
- Coverage      77%     62%    -15%     
========================================
  Files         447     372     -75     
  Lines       21472   14476   -6996     
  Branches     3527    1145   -2382     
========================================
- Hits        16444    8860   -7584     
- Misses       5024    5413    +389     
- Partials        4     203    +199
Flag Coverage Δ
#Linux ?
#Windows ?
#macOS ?

d3r3kk added 24 commits March 12, 2019 13:43
- first pass of the new test discovery API exec
- trying to not change anything outside of unittest
  - particularly outside of pytest
- Make the run_adapter placeholder return an array
- use JSON.Parse on the returned result in parser
- Add a script that just spits out test data
- Use python.pythonPath for the exe path
- Put the run_adapter.py script as the first arg to the process
- Add the rest of the necessary args to the script.
- Add `discover` method alongside `run` method
- Focusing on running discovery via the new Python adapter
- This will be the call for each test framework going forward
- New data type expected from Python `DiscoveredTestData`
- New class to transform from DiscoveredTestData to Tests
- Updated `pytest/parserService.ts` to use this new method of discovery
- A bit of a logic re-jig
- start testing to ensure the new discovery works the same as the old
- Fix up test data for path case variance.
- Fix bug with parser throwing on empty input
- Tests for the discoveredTests
- Tests fixed for the discoveryService
- simplify tests for the parserService
- remove a non-unit test from running during unit test runs
- Use `exec` over `execObservable` in running Python for test discovery.
- Create a new interface for test discovery runner.
@d3r3kk d3r3kk force-pushed the 4035_pytest_discovery branch from 7f7cf5f to 8ad18c1 Compare March 12, 2019 20:46
d3r3kk added 2 commits March 12, 2019 17:07
- needs to be refactored for the new parser model
- tracked by GH microsoft#4735
- Many tests will need refactoring with the new discovery API
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 do not merge:

  • File names, folder names, suite names and function names are not returned by python code (new PR #4695 will solve this)
  • Extracting names from IDs is not the right approach (that's business logic that needs to sit in python code, as its the python code that knows how ids are formed) (new PR #4695 will solve this)
  • Id is unique identifier, and we shouldn't assume it contains names of files, suites and functions

As a result of this:

  • Code lenses will not work (line numbers returned by python code is not used, as user may have modified the code with auto test discover disabled)
  • Selection of tests for running will not display user friendly names

Summary:

  • We need to get python code to return the names
  • Else we leave code in broken state, that should not be done in PRs
  • We need to wait for PR #4695

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.

A lot of the code will change due to the data structure returned by the python code.
Best to wait until that's completed.

if parts.pop(0) != filename:
# TODO: What to do?
if os.path.normcase(parts.pop(0)) != filename:
# The filename of this node doesn't match the filename within the node id?

Choose a reason for hiding this comment

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

We need to file an issue about this and fix this accordingly.
/cc @ericsnowcurrently

pytestargs.insert(0, '--collect-only')
pytestargs.insert(0, '-pno:terminal')
pytestargs.insert(0, '--collect-only')
pytestargs.insert(0, '--cache-clear')

Choose a reason for hiding this comment

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

@@ -0,0 +1,94 @@
import json

Choose a reason for hiding this comment

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

Where is this file being used?

@DonJayamanne
Copy link

@d3r3kk
Unfortunately I've got to create a branch from yours and start separately.
I just rebased master onto your branch, but I cannot force push upstream
Your commits won't be lost, so nothing lost, just that it'll end up as a new PR..hope thats ok.

@DonJayamanne
Copy link

@d3r3kk
Better yet, I'm going to create a new branch based off Erics branch and merge your changes on top of that.,, that way i have best of both worlds..

DonJayamanne added a commit that referenced this pull request Apr 11, 2019
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants