-
Notifications
You must be signed in to change notification settings - Fork 39
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
Test pkg_resource usage #2799
Test pkg_resource usage #2799
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2799 +/- ##
=======================================
Coverage 57.04% 57.04%
=======================================
Files 567 567
Lines 41285 41289 +4
=======================================
+ Hits 23549 23555 +6
+ Misses 17736 17734 -2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests look just fine and should be good for both coverage and refactoring, but I have my usual nitpicks about test naming 😁
The final use of pkg_resources already has a test: |
Setup for black in github does not agree with setup for black in pre-commit, sigh. |
I can't recall specifically why it's there, but "expensiveness" has nothing to do with it. The test utilizes a 3rd party library to test the validity of a resource file that is distributed with NAV, which doesn't fit neatly into the "unit test" category in my mind. |
That must be an issue in your end. I checked out your branch, changed one letter in a test method name touched by 566dd2b and my pre-commit hook reformatted things exactly as expected by Black on GitHub. Just a manual run of pre-commit on an unchanged version of your file also confirms it: $ pre-commit run --files tests/unittests/config_test.py
Trim Trailing Whitespace.................................................Passed
Mixed line ending........................................................Passed
Flake8: critical.........................................................Passed
black....................................................................Failed
- hook id: black
- files were modified by this hook
reformatted tests/unittests/config_test.py
All done! ✨ 🍰 ✨
1 file reformatted.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provisionally accepted, as long as you get your pre-commit hooks working again :)
pyproject.toml says linelength should be 88. precommit does not set a line-length. github actions seems to want them to be shorter than 100 since the latest lint round shortened a single line (long test-name) from 101 chars to 95 chars. So what is correct? If a testname is longer than 88 chars, should we let black move the parameters to a new line or should we just noqa it? |
Why would we want to set a separate line-length value just for pre-commit?
No, github actions doesn't want anything. It runs Black on the source file, and Black, configured with a --- a/tests/unittests/config_test.py
+++ b/tests/unittests/config_test.py
@@ -5,7 +5,9 @@ from unittest import TestCase
class TestConfigResourceWalk(TestCase):
- def test_should_read_relative_paths_as_strings_from_nav_package_and_return_a_long_list_of_strings(self):
+ def test_should_read_relative_paths_as_strings_from_nav_package_and_return_a_long_list_of_strings(
+ self,
+ ):
# result should be many, many relative paths as strings
result = tuple(_config_resource_walk()) # generator
self.assertTrue(len(result) > 20) The GitHub superlinter sees that Black changed something, and raises a red flag. Black cannot break up a long function name, so it leaves it alone - but it certainly can and will move the function arguments to the next line, according to regular Black semantics.
Leave Black alone to do its thing, that's what it's there for :) |
a049487
to
e9203f2
Compare
Quality Gate passedIssues Measures |
Ensure that the stuff that uses pkg_resource is tested, so that we can know it all still works after replacing pkg_resources with importlib.
Preparation for #2791.