Skip to content

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

Merged
andrecsilva merged 4 commits intomainfrom
pytest-raises-with-assertions
Jan 22, 2024
Merged

Codemod: remove-assertion-in-pytest-raises#219
andrecsilva merged 4 commits intomainfrom
pytest-raises-with-assertions

Conversation

@andrecsilva
Copy link
Copy Markdown
Contributor

Overview

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

@codecov
Copy link
Copy Markdown

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
Comment thread src/core_codemods/remove_assertion_in_pytest_raises.py Outdated
Comment thread src/core_codemods/remove_assertion_in_pytest_raises.py Outdated
Comment thread tests/codemods/test_remove_assertion_in_pytest_raises.py
if not self.filter_by_path_includes_or_excludes(
self.node_position(original_node)
):
return updated_node
Copy link
Copy Markdown
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

@sonarqubecloud
Copy link
Copy Markdown

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
@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