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

Remove unused test variables #3033

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

johannaengland
Copy link
Contributor

Just like #3028 and #3029 another part in adding F841 to ruff.

Copy link

sonarcloud bot commented Sep 25, 2024

Copy link

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 992 0 11.24s
✅ PYTHON ruff 987 0 0.09s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

Copy link

Test results

    7 files      7 suites   4m 31s ⏱️
2 128 tests 2 127 ✅ 0 💤 1 ❌
2 956 runs  2 954 ✅ 0 💤 2 ❌

For more details on these failures, see this check.

Results for commit 3650463.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.47%. Comparing base (5d6feef) to head (3650463).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3033   +/-   ##
=======================================
  Coverage   60.47%   60.47%           
=======================================
  Files         605      605           
  Lines       43816    43816           
  Branches       48       48           
=======================================
  Hits        26497    26497           
  Misses      17307    17307           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -84,7 +86,7 @@ def test_three_lines_with_two_rows_should_be_counted_as_three(self):
b"room1:10.0.0.187:myorg:OTHER:SNMP v2c read profile::\n"
)
b = bulkparse.NetboxBulkParser(data)
out_data = list(b)
itertools.consume(b)
Copy link
Member

Choose a reason for hiding this comment

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

That failed pretty fast. I know this was my suggestion, but I must have hallucinated it. I might have built such thing myself at some point. While modules like itertools have lots of little utilities to deal with iterators, this wasn't one of them.

You could use collections.deque with a maximum length of 0 as a fast way to explicitly exhaust a generator, although it doesn't read as well:

Suggested change
itertools.consume(b)
deque(b, maxlen=0)

Copy link
Member

Choose a reason for hiding this comment

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

or, you could keep using the original list statement and add a short comment as to why, so people don't read it and scratch their heads...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants