-
Notifications
You must be signed in to change notification settings - Fork 89
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 py2-specific dependencies and fix tests #192
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I dare say the tests are using Python 2.7 instead of the Python they were supposed to test. |
I'm going to experiment a little trying to fix it. |
mgorny
force-pushed
the
py3-mock
branch
3 times, most recently
from
February 23, 2021 07:54
399070c
to
27b293b
Compare
Replace the use of external 'mock' package with the 'unittest.mock' module provided by Python 3. Since Python 2 is no longer supported, this eliminates an unnecessary dependency.
mgorny
changed the title
Use built-in Python 3 unittest.mock module
Remove py2-specific dependencies and fix tests
Feb 23, 2021
The pytest executable is called 'pytest' now. While the old name is still provided, it's better to use the new one in case some future version removed it.
Ok, it's ready for review now. |
Great catch, thanks! |
miketheman
added a commit
to miketheman/readme_renderer
that referenced
this pull request
Mar 9, 2022
Surfaced via `mypy`, in that the `html.parser` module does not have a direct implementation of `unescape`. Refs: https://docs.python.org/3.6/library/html.html#html.unescape In pypa#192 support for Python 2.7 was removed, the import path changed. This works due to imports placing the imported code in the local scope. If the `html.parser` module ever stopped importing `unescape`, this import would break as a result. Signed-off-by: Mike Fiedler <miketheman@gmail.com>
di
pushed a commit
that referenced
this pull request
Mar 11, 2022
* chore: add mypy testing Scaffolding in the testing, and will not complete succssfully yet. Will be followed by code changes to pass. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * lint: ignore empty dict Surfaced via `mypy`, in that an empty dict could not infer what types could be there. Instead of importing `typing` and annotating the empty Dict, I opted to ignore the line, as we do not expect to populate the dict at all, and are using it to **prevent** additions to the value. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore: remove unused styles parameter Surfaced via `mypy`, recommended adding a type to the empty list. The list was originally empty back in 0.1.0. Instead of adding a type, remove the constant, and the code that uses it from `clean()` - as it was partially reverted in #121. The default `ALLOWED_STYLES` in the underlying library is `[]`. Related: #114 (comment) Signed-off-by: Mike Fiedler <miketheman@gmail.com> * fix: correct import for unescape Surfaced via `mypy`, in that the `html.parser` module does not have a direct implementation of `unescape`. Refs: https://docs.python.org/3.6/library/html.html#html.unescape In #192 support for Python 2.7 was removed, the import path changed. This works due to imports placing the imported code in the local scope. If the `html.parser` module ever stopped importing `unescape`, this import would break as a result. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore: update pytest markers cli flag Currently emits a warning: PytestRemovedIn8Warning: The --strict option is deprecated, use --strict-markers instead. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore(types): add types to clean module Surfaced by running mypy in strict mode, and added types where relevant. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore(types): add types to txt module Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore(types): add types to markdown module Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore: add types to rst module The types-docutils hints are still incomplete, good progress is being made. See: python/typeshed#7256 I've had to use an ignore on the class inheritance, and a couple of `typing.Any` annotations until that package implements more type hints. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore: ignore distutils module from types `mypy` strict mode is having a hard time with the `distutils` imports, since they are wrapped in `setuptools` right now as a private package. This pacakge's distutils integration will need to be reworked anyhow. Left a comment with details at the top of the file. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * test: use strict mode for mypy Prevent new things from creeping in during development. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore: tell the world we've got types Include a blank `py.typed` file in the package to inform `mypy` that there's types to be found in this package. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * chore: move strict flag to config Allows other tools to ebenfit from a consistent configuration. Signed-off-by: Mike Fiedler <miketheman@gmail.com> * refactor: change imports to be consistent with others Signed-off-by: Mike Fiedler <miketheman@gmail.com> * docs: add inline details for specific ignores Signed-off-by: Mike Fiedler <miketheman@gmail.com> * lint: apply more specific type Signed-off-by: Mike Fiedler <miketheman@gmail.com> * docs: add comment to why source is Any Signed-off-by: Mike Fiedler <miketheman@gmail.com> * lint: replace typing imports with relative ones Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
mock
with py3'sunittest.mock
.six
.pytest
executable name.