-
-
Notifications
You must be signed in to change notification settings - Fork 588
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
Updates round 2 #2329
base: main
Are you sure you want to change the base?
Updates round 2 #2329
Conversation
This package is in maintenance only mode and only had two uses. Replace their use with the `tmp_path` fixture as suggested in the docs[1] Link: https://docs.pytest.org/en/8.3.x/reference/reference.html#tmpdir [1]
There was one new error: TypeError: exceptions must be derived from Warning, not <class 'NoneType'> Fix this following the docs[1] Link: https://docs.pytest.org/en/8.3.x/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests [1]
This required fixes an error in the config (I also updated the relevant link, the old one would 404): ValueError: Error code '#' supplied to 'extend-ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$' And some errors in the code: isort/literal.py:59:8: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` tests/unit/test_isort.py:13:1: F401 'typing.Dict' imported but unused The second test conflicted with `mypy`, since `Dict` was only used in commented annotations, to make them both happy move one of these annotations out of a comment (in the future we should probably move all such annotations out of comments)
This required addressing some errors from `mypy`: tests/integration/test_setting_combinations.py:20: error: "SearchStrategy" expects no type arguments, but 1 given [type-arg] tests/integration/test_hypothesmith.py:36: error: "SearchStrategy" expects no type arguments, but 1 given [type-arg]
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2329 +/- ##
=======================================
Coverage 99.12% 99.12%
=======================================
Files 39 39
Lines 3095 3095
Branches 787 787
=======================================
Hits 3068 3068
Misses 15 15
Partials 12 12 |
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.
tests/unit/test_main.py
Outdated
python_file.write(import_content) | ||
tmpdir.join("no_imports.py").write("...") | ||
subprocess.run(["git", "init", str(tmp_path)]) | ||
python_file = tmp_path.joinpath("has_imports.py") |
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.
Could you use /
here as well as other places? I believe that is more idiomatic?
tests/unit/test_main.py
Outdated
|
||
out, error = main_check( | ||
[str(git_project0), "--skip-gitignore", "--filter-files", "--check"] | ||
) | ||
|
||
should_check = ["/git_project0/has_imports.py"] | ||
|
||
assert all(f"{str(tmpdir)}{file}" in error for file in should_check) | ||
assert all(f"{str(tmp_path)}{file}" in error for file in should_check) |
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.
Using both str
and f"
shouldn't be necessary for Path
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.
Using both
str
andf"
shouldn't be necessary forPath
what do you think about making this a separate change: I see there are several points in this file (including parts not touched by this change) that could do with the same update? I'm happy to include it in this patch, but my main goal was to just get things working, without changing things too much
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.
Is it possible to exclude the py
change and do that together with the changes in a separate PR?
If not, let's at least make sure the code we're touching now in this diff is correct and worry about the rest later.
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.
If not, let's at least make sure the code we're touching now in this diff is correct and worry about the rest later.
👍 830eca7
tests/unit/test_isort.py
Outdated
@@ -1629,13 +1629,13 @@ def test_multiline_import() -> None: | |||
assert isort.code(test_input) == ("from pkg import more_stuff, other_suff, stuff\n") | |||
|
|||
# test again with a custom configuration | |||
custom_configuration = { | |||
custom_configuration: Dict[str, Any] = { |
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.
Can you use dict[str, Any]
?
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.
Can you use
dict[str, Any]
?
yep, now that we don't support Python 3.8 that will work
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.
done with cbd07e0
I've pushed some fixup commits, so let me know just before merge and I'll rebase to squash them back in to the correct commits |
Lint is unhappy
becuase that file uses type comments like EDIT: actually, it complains even when imported only when EDIT EDIT: 4efc999 |
Second round of updates, split out to keep PRs reasonable size
Drop
py
dependencyThis package is in maintenance only mode and only had two uses. Replace
their use with the
tmp_path
fixture as suggested in the docs[1]Link: https://docs.pytest.org/en/8.3.x/reference/reference.html#tmpdir [1]
Update
pytest
There was one new error:
Fix this following the docs[1]
Link: https://docs.pytest.org/en/8.3.x/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests [1]
Update
black
Update
flake8
This required fixes an error in the config (I also updated the relevant
link, the old one would 404):
And some errors in the code:
The second test conflicted with
mypy
, sinceDict
was only used incommented annotations, to make them both happy move one of these
annotations out of a comment (in the future we should probably move all
such annotations out of comments)
Update
hypothesis
This required addressing some errors from
mypy
: