Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Re-export top-level imports to satisfy Mypy #19

Merged

Conversation

reivilibre
Copy link
Contributor

Using Mypy (at least in strict mode) with the library as it currently is causes errors.

import aiounittest


class ExampleTest(aiounittest.AsyncTestCase):
    def test_example(self) -> None:
        self.assertEqual(1, 2 - 1)
tests/test_example.py:4: error: Name "aiounittest.AsyncTestCase" is not defined
tests/test_example.py:4: error: Class cannot subclass "AsyncTestCase" (has type "Any")

It seems to be good practice to 're-export' (using __all__) all the things that you import into a module and wish to allow others to use as an import. I don't think this is actually functionally different, but just a convention.
IDEs (auto-import feature) and Mypy pick up on this, at the very least.

Signed-off-by: Olivier Wilkinson (reivilibre) oliverw@matrix.org
I am happy for these changes to be available under the project's licence (MIT).

Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
reivilibre added a commit to matrix-org/synapse-module-cookiecutter-template that referenced this pull request Oct 21, 2021
I have opened a [PR] against aiounittest to resolve this

[PR]: kwarunek/aiounittest#19
@kwarunek
Copy link
Owner

Great. Thx

@kwarunek kwarunek merged commit ff73304 into kwarunek:master Oct 22, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants