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

feat: update test_results_parser version and start computing names #742

Merged
merged 7 commits into from
Oct 15, 2024

Conversation

joseph-sentry
Copy link
Contributor

This commit updates the version of the test_results_parser library
that we are using:

  • no more support for parsing vitest.json or pytest-reportlog files

  • parse_junit_xml now returns a ParsingInfo class, the type signature
    looks something like:

    class ParsingInfo:
    testruns: list[Testrun]
    framework: framework

    where Framework is:

    class Framework(Enum):
    Pytest
    Jest
    Vitest
    PHPUnit

  • Testrun also now contains the filename field which is an optional
    string and a classname field

We've also started computing the name of the test which just means
depending on the framework we've detected we transform the raw name
and classname from the JUnit file to something more readable and if
that computed name is available it's what we should show in the PR
comment

@joseph-sentry joseph-sentry marked this pull request as draft September 25, 2024 20:37
Copy link

This PR includes changes to shared. Please review them here: codecov/shared@403d5a2...106b0ae

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 94.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 98.00%. Comparing base (3aa88f7) to head (6c6cb0b).
Report is 9 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/test_results_processor.py 89.15% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #742      +/-   ##
==========================================
- Coverage   98.03%   98.00%   -0.03%     
==========================================
  Files         438      438              
  Lines       36469    36451      -18     
==========================================
- Hits        35751    35725      -26     
- Misses        718      726       +8     
Flag Coverage Δ
integration 98.00% <94.00%> (-0.03%) ⬇️
unit 98.00% <94.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.85% <89.88%> (-0.06%) ⬇️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
database/models/reports.py 99.53% <100.00%> (+<0.01%) ⬆️
services/test_results.py 90.00% <100.00%> (-0.06%) ⬇️
services/tests/test_test_results.py 100.00% <ø> (ø)
tasks/test_results_finisher.py 93.60% <ø> (ø)
tasks/tests/unit/test_test_results_finisher.py 100.00% <100.00%> (ø)
...sks/tests/unit/test_test_results_processor_task.py 100.00% <100.00%> (ø)
tasks/test_results_processor.py 94.27% <89.15%> (-4.08%) ⬇️

... and 1 file with indirect coverage changes

@codecov-staging
Copy link

codecov-staging bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 94.00000% with 9 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/test_results_processor.py 89.15% 9 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #742      +/-   ##
==========================================
- Coverage   98.03%   98.00%   -0.03%     
==========================================
  Files         438      438              
  Lines       36469    36451      -18     
==========================================
- Hits        35751    35725      -26     
- Misses        718      726       +8     
Flag Coverage Δ
integration 98.00% <94.00%> (-0.03%) ⬇️
unit 98.00% <94.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.85% <89.88%> (-0.06%) ⬇️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
database/models/reports.py 99.53% <100.00%> (+<0.01%) ⬆️
services/test_results.py 90.00% <100.00%> (-0.06%) ⬇️
services/tests/test_test_results.py 100.00% <ø> (ø)
tasks/test_results_finisher.py 93.60% <ø> (ø)
tasks/tests/unit/test_test_results_finisher.py 100.00% <100.00%> (ø)
...sks/tests/unit/test_test_results_processor_task.py 100.00% <100.00%> (ø)
tasks/test_results_processor.py 94.27% <89.15%> (-4.08%) ⬇️

... and 1 file with indirect coverage changes

@codecov-qa
Copy link

codecov-qa bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 94.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 98.00%. Comparing base (3aa88f7) to head (6c6cb0b).
Report is 9 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/test_results_processor.py 89.15% 9 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #742      +/-   ##
==========================================
- Coverage   98.03%   98.00%   -0.03%     
==========================================
  Files         438      438              
  Lines       36469    36451      -18     
==========================================
- Hits        35751    35725      -26     
- Misses        718      726       +8     
Flag Coverage Δ
integration 98.00% <94.00%> (-0.03%) ⬇️
unit 98.00% <94.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.85% <89.88%> (-0.06%) ⬇️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
database/models/reports.py 99.53% <100.00%> (+<0.01%) ⬆️
services/test_results.py 90.00% <100.00%> (-0.06%) ⬇️
services/tests/test_test_results.py 100.00% <ø> (ø)
tasks/test_results_finisher.py 93.60% <ø> (ø)
tasks/tests/unit/test_test_results_finisher.py 100.00% <100.00%> (ø)
...sks/tests/unit/test_test_results_processor_task.py 100.00% <100.00%> (ø)
tasks/test_results_processor.py 94.27% <89.15%> (-4.08%) ⬇️

... and 1 file with indirect coverage changes

Copy link

codecov-public-qa bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 94.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 98.00%. Comparing base (3aa88f7) to head (6c6cb0b).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #742      +/-   ##
==========================================
- Coverage   98.03%   98.00%   -0.03%     
==========================================
  Files         438      438              
  Lines       36469    36451      -18     
==========================================
- Hits        35751    35725      -26     
- Misses        718      726       +8     
Flag Coverage Δ
integration 98.00% <94.00%> (-0.03%) ⬇️
unit 98.00% <94.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.85% <89.88%> (-0.06%) ⬇️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
database/models/reports.py 99.53% <100.00%> (+<0.01%) ⬆️
services/test_results.py 90.00% <100.00%> (-0.06%) ⬇️
services/tests/test_test_results.py 100.00% <ø> (ø)
tasks/test_results_finisher.py 93.60% <ø> (ø)
tasks/tests/unit/test_test_results_finisher.py 100.00% <100.00%> (ø)
...sks/tests/unit/test_test_results_processor_task.py 100.00% <100.00%> (ø)
tasks/test_results_processor.py 94.27% <89.15%> (-4.08%) ⬇️

... and 1 file with indirect coverage changes

@joseph-sentry joseph-sentry requested a review from a team October 1, 2024 18:41
This commit updates the version of the test_results_parser library
that we are using:
- no more support for parsing vitest.json or pytest-reportlog files
- parse_junit_xml now returns a ParsingInfo class, the type signature
  looks something like:

    class ParsingInfo:
        testruns: list[Testrun]
        framework: framework

  where Framework is:

    class Framework(Enum):
        Pytest
        Jest
        Vitest
        PHPUnit

- Testrun also now contains the filename field which is an optional
  string and a classname field

We've also started computing the name of the test which just means
depending on the framework we've detected we transform the raw name
and classname from the JUnit file to something more readable and if
that computed name is available it's what we should show in the PR
comment
Copy link

github-actions bot commented Oct 3, 2024

This PR includes changes to shared. Please review them here: https://github.com/codecov/shared/compare/88117b96a4b420d88549b8df2649c3eb9c61c2a5...

@joseph-sentry joseph-sentry marked this pull request as ready for review October 3, 2024 15:28
@joseph-sentry joseph-sentry marked this pull request as draft October 3, 2024 15:30
@joseph-sentry joseph-sentry marked this pull request as ready for review October 8, 2024 15:57
Copy link

github-actions bot commented Oct 8, 2024

This PR includes changes to shared. Please review them here: https://github.com/codecov/shared/compare/88117b96a4b420d88549b8df2649c3eb9c61c2a5...

Copy link

github-actions bot commented Oct 9, 2024

This PR includes changes to shared. Please review them here: https://github.com/codecov/shared/compare/b9e83b2c2f072749bae36c18b80d384b8cc50d94...

Copy link
Contributor

@michelletran-codecov michelletran-codecov left a comment

Choose a reason for hiding this comment

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

Just a few comments

Comment on lines 460 to 462
print("BBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
except ParserError as e:
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove print statements

@@ -0,0 +1 @@
{"network_files": ["api/temp/calculator/test_calculator.py"], "test_results_files": [{"filename": "codecov-demo/temp.junit.xml", "format": "base64+compressed", "data": "eJy1VMluwjAQvfMVI1dCoBbHZiklJEFVS4V66Kkqx8okBqw6i2KHwt/XWSChnCrRXDLjefNm8Uuc2T6UsOOpEnHkIooJAh75cSCijYsyve49oJnnaK60yoR5NWyIWMhdlBzyE5OWpnGqXGQY1kzILOXGoQjUl0gSHhSBItdFQ2OJPJdgMuqXjtIsTFzUJ/1Bj9IeuX+n1KZjmwwxoZSMDWwbK13W/HhZvC1fn5eLCZaxzyQq2/KZ4uBLplQJY4nAmocJNhA/k0zHKc5xn7WPqimKYxYEjc6Iad66DrHKVjplvv4f9jCTWiTy0GQnV2MPxE4E/Lxzz6muGMzFKbbJaZXiqQajIHBdIHjUvqFkCrcA31tugEUA2lJP11nkayM3eKobKIsA00D2lAz9CV9NSHujpx16B/3uievI9mceU/sChryAr6ExZKdrtwpw+VQjXeSVPVVjtubn6HoBp8iVlnDGd9VFtFpGFFYuCqsWgfVLFDg52ANiw2Mxpyk3zz94x6qU4DnWUW2VWfwkmrbyfgBbcXMH", "labels": ""}], "metadata": {}}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can we format these json better? This will make it easier to read and debug errors.

Comment on lines 430 to 431
# TODO: this is bad
self.network = data.get("network_files")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add more context into why this is bad? I see that network_files is supposed to be in the uploaded test file, but I don't have much context into why getting this here is a bad thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, this was a note for myself to revisit, the alternative to this is to return the network from the function, which i think makes more sense, but i wanted to quickly make sure it worked so i just set it as an attribute on the task itself, will fix this with the next commit

- change test_results_processor to pass network through to compute_name
  instead of setting it as an attribute on the Task
- change sample_test files from txt to json
Copy link
Contributor

@michelletran-codecov michelletran-codecov left a comment

Choose a reason for hiding this comment

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

Generally LGTM! Just a question about one of the class names.

Comment on lines 104 to 105
name = raw_name
return name
Copy link
Contributor

Choose a reason for hiding this comment

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

simplification suggestion:

Suggested change
name = raw_name
return name
return raw_name

test_instance_data = []
test_flag_bridge_data = []
daily_totals = dict()
daily_totals: dict[str, dict[str, str | int | list[str]]] = dict()
Copy link
Contributor

Choose a reason for hiding this comment

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

Not something to do in this PR, but I would consider creating a custom object/type/dataclass to simplify this complex type annotation.



@dataclass
class argProcessingResult:
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 supposed to be ProcessingResult or ArgProcessingResult?

@joseph-sentry joseph-sentry added this pull request to the merge queue Oct 15, 2024
Merged via the queue into main with commit 39fb207 Oct 15, 2024
17 of 27 checks passed
@joseph-sentry joseph-sentry deleted the joseph/framework-detection branch October 15, 2024 18:39
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.

2 participants