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

Align setUp and tearDown type signatures with unittest and rdflib.plugin #111

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ajnelson-nist
Copy link

The references below indicate the type requirements' sources.

When reviewing subclasses of GraphTestCase, setUp and tearDown did no further work than the parent class GraphTestCase once the signatures were aligned with typeshed.stdlib, so the methods were removed.

The first patch was driven by the following command after activating type review on setUp and tearDown (adding -> None):

mypy test/test_sqlalchemy_sqlite.py

The first patch was then tested with the following command after identifying sibling ("cousin?") classes of the SQLite test. This command raised no errors after deactivating type review (adding # type: ignore) on a package that does not currently provide type signatures:

mypy \
  test/test_sqlalchemy_mysql.py \
  test/test_sqlalchemy_postgresql.py \
  test/test_sqlalchemy_postgresql_pg8000.py \
  test/test_sqlalchemy_sqlite.py

Note: The first patch was not tested by re-running the test suite. However, I do think it will help with future review.

Disclaimer:

Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose.

References

@ajnelson-nist ajnelson-nist changed the title Align setUp and tearDown type signatures with unitest and rdflib.plugin Align setUp and tearDown type signatures with unittest and rdflib.plugin Dec 6, 2024
The references below indicate the type requirements' sources.

When reviewing subclasses of `GraphTestCase`, `setUp` and `tearDown` did
no further work than the parent class `GraphTestCase` once the
signatures were aligned with `typeshed.stdlib`, so the methods were
removed.

This patch was driven by the following command after activating type
review on `setUp` and `tearDown` (adding `-> None`):

```bash
mypy test/test_sqlalchemy_sqlite.py
```

This patch was then tested with the following command after identifying
sibling ("cousin?") classes of the SQLite test.  This command raised no
errors after deactivating type review (adding `# type: ignore`) on a
package that does not currently provide type signatures:

```bash
mypy \
  test/test_sqlalchemy_mysql.py \
  test/test_sqlalchemy_postgresql.py \
  test/test_sqlalchemy_postgresql_pg8000.py \
  test/test_sqlalchemy_sqlite.py
```

Disclaimer:
Participation by NIST in the creation of the documentation of mentioned
software is not intended to imply a recommendation or endorsement by the
National Institute of Standards and Technology, nor is it intended to
imply that any specific software is necessarily the best available for
the purpose.

References:
* https://github.com/RDFLib/rdflib/blob/7.1.1/rdflib/plugin.py#L128
* https://github.com/python/typeshed/blob/b40eb642e00c538e29fb037992eb4b21d9ff108c/stdlib/unittest/case.pyi#L119-L120

Signed-off-by: Alex Nelson <[email protected]>
@ajnelson-nist
Copy link
Author

Force-pushing to fix a typo in the commit message.

@ajnelson-nist ajnelson-nist force-pushed the align_setup_teardown_signatures branch from d43fbb9 to 409bae8 Compare December 6, 2024 15:06
@nicholascar nicholascar self-requested a review December 17, 2024 01:19
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.

3 participants