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

Codemod: remove-assertion-in-pytest-raises #219

Merged
merged 4 commits into from
Jan 22, 2024

Conversation

andrecsilva
Copy link
Contributor

Overview

Adds a codemod that removes assertions from the bottom of pytest.raises context manager.

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (4cbcb6b) 96.45% compared to head (2299d70) 96.44%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
- Coverage   96.45%   96.44%   -0.01%     
==========================================
  Files          96       97       +1     
  Lines        4090     4169      +79     
==========================================
+ Hits         3945     4021      +76     
- Misses        145      148       +3     
Files Coverage Δ
src/core_codemods/__init__.py 100.00% <100.00%> (ø)
...core_codemods/remove_assertion_in_pytest_raises.py 96.15% <96.15%> (ø)

@andrecsilva andrecsilva marked this pull request as ready for review January 19, 2024 13:21
if not self.filter_by_path_includes_or_excludes(
self.node_position(original_node)
):
return updated_node
Copy link
Contributor

Choose a reason for hiding this comment

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

you added a test_exclude_line but still it says not covered.... weird.

Well actually, given this is a leave_with node, it's likely the same issue as the other codemods with this todo # TODO: add filter by include or exclude that works for nodes. So I think you can go ahead and remove the unit test and just add the todo line

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions

D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

idea Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

@andrecsilva andrecsilva added this pull request to the merge queue Jan 22, 2024
Merged via the queue into main with commit 2c094e8 Jan 22, 2024
13 of 14 checks passed
@andrecsilva andrecsilva deleted the pytest-raises-with-assertions branch January 22, 2024 11:48
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