-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Stop faking builtins for tests #890
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
Comments
Actually it looks like there are more buggy tests, but line 8 here is not a bug in the test: https://travis-ci.org/o11c/mypy/jobs/83400574#L1225 It should not be an error to assign a |
I've managed to figure out what change was needed in the fixture (PR coming as soon as I fix the rest of the buggy tests), but this is still a horrible idea. |
Mypy mostly has unit tests, not integration tests (the pythoneval suite is a separate integration suite that uses full stubs). There are some drawbacks, but I rarely have had any issues that haven't been trivial to work around, and making tests run about 10x faster or so is definitely a huge win for productivity. Benefits of having unit tests:
The main drawback is that you have to maintain the fixtures, but that's generally simple (just a little tedious, but less tedious than slow iteration speed due to not having them). And yeah, and the fixtures are intended to be not 100% representative to get better test isolation. That can be tweaked on a case by case basis. |
One additional point: parallelizing tests is also very useful because that also speeds up tests. Currently running mypy unit tests locally is kind of slow (as there are many tests), so the new parallel test driver will be very useful. |
Recently, I wrote a patch that worked perfectly in mypy, but (after fixing one buggy test) caused several unit tests to fail because the unit tests don't use the real builtins, rather some file under
mypy/test/data/fixtures/
It does not matter how fast your tests execute if they are not representative of what mypy will actually use. You should look for performance improvements elsewhere - perhaps by only ever using the parts of a module that are used from the main file.
The text was updated successfully, but these errors were encountered: