-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Figure out a way to have test cases for third-party stubs #8569
Comments
As @srittau wrote in #8505 (comment):
|
To get us started on this, I think it would make sense to outline a few stubs that would be good candidates for this so that we can leverage those stubs when prototyping or suggesting approaches. |
In Link: https://github.com/typeddjango/django-stubs/blob/master/scripts/typecheck_tests.py |
Some updates on my plan for this:
|
Most of the requests problems were introduced when mypy_primer was broken for third-party stubs. |
Yeah, mypy_primer is and always will be our best tool for catching regressions. The |
I can help write tests for some of aspects of Flask-SQLalchemy and SQLAlchemy, depending on the coverage goals. To the question of what it is that we're testing, what should these tests actually be covering? What I mean by that is meant to be the specifics not the ideological discussion covered in #8505, e.g. are we testing that the behavior is functional (so using an in-memory or external database service to verify both the actions and the types) and the types pass, or only that the types pass for idiomatic use cases (essentially acting as a form of documentation while providing a bit more security in updates)? If using external services, such as the database in the case above or an external service's URL for requests, what external resources does the team want to use for these, as this has implications on test stability if there are downstream outages or issues? |
Thanks for the offer! I appreciate it.
As stated in the
The test cases being discussed in this issue shouldn't need access to any external services. The code in these test cases is never actually run; we just run the type checkers on the code so that we can assert that type-checking errors are emitted in the correct places. This isn't a comprehensive way of testing stubs, but it's not meant to be; if we want to discuss more comprehensive ways of testing stubs, we should do that elsewhere :) |
OK, cool. So in terms of infrastructure, what you mean by that is:
The above assumes that we'd use Is there anything I'm missing / am I over simplifying what's required? |
That pretty much covers it, yeah. I've assigned this issue to me to indicate that I'd like to work on these steps :) |
One complicating factor is: If we can figure out the right way to organise our |
Okay, here's a PR! Reviews welcome: |
We currently only have test cases for our stdlib stubs, and don't currently have the infrastructure set up to allow us to add test cases for any of our third-party stubs. This has come up a few times now, so it would be good to figure out a way to get this to work.
(This issue relates to the test cases in our
test_cases
directory. Currently we test these samples with mypy and pyright.)The text was updated successfully, but these errors were encountered: