Skip to content
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

Add --code flag for collecting code context. #1154

Merged
merged 9 commits into from
Dec 19, 2024

Conversation

rnemes
Copy link
Contributor

@rnemes rnemes commented Dec 4, 2024

Bug / Requirement Description

Include the 1 liner of the testcase assertion (top-level from testcase) into the report.

Solution description

Added --code flag to collect code context for the assertions. Code context one-liner will be displayed on the web UI if enabled.
Note that file path information is no longer collected by default. To collect file path information, enable code context.

Checklist:

  • Test
  • Example (both test_plan.py and .rst)
  • Documentation (API)
  • News fragment present for release notes
  • MS info leakage check
  • For new driver: driver index page
  • For new assertion: ui/pdf/std renderers, documentation
  • For new cmdline arg: documentation

@rnemes rnemes requested a review from a team as a code owner December 4, 2024 19:29
* @param {String} path
*/
export const getWorkspacePath = (path) => {
const srcIndex = path.indexOf('/src/');
Copy link
Contributor Author

@rnemes rnemes Dec 11, 2024

Choose a reason for hiding this comment

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

This only works on linux

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Discussed this offline.) This is a request from management, the full path will be visible in the popup.

if enabled.
"""
return getattr(self.cfg, "collect_code_context", False)

Copy link
Contributor

Choose a reason for hiding this comment

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

is this just for orphan multitest in testing?

Copy link
Contributor

Choose a reason for hiding this comment

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

might need it for hooks & maybe result call under pytest wrapper

testplan/testing/multitest/base.py Outdated Show resolved Hide resolved
tests/unit/testplan/testing/multitest/test_result.py Outdated Show resolved Hide resolved
testplan/testing/multitest/base.py Outdated Show resolved Hide resolved
testplan/testing/multitest/base.py Outdated Show resolved Hide resolved
@rnemes rnemes self-assigned this Dec 13, 2024
@rnemes rnemes changed the title Added --code flag for collecting code context. Add --code flag for collecting code context. Dec 13, 2024
@rnemes rnemes requested review from Pyifan and zhenyu-ms December 16, 2024 15:40
testplan/testing/result.py Outdated Show resolved Hide resolved
@rnemes rnemes requested a review from Pyifan December 17, 2024 19:21
@Pyifan Pyifan merged commit 9f93423 into morganstanley:main Dec 19, 2024
15 checks passed
@rnemes rnemes deleted the code_context branch December 19, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants