Comments (7)
I like it!
But, I think I need to explain why current format exists (and will be supported in the future).
It main feature is that you can copy-paste "Actual" output from mypy there. I sometime do this:
- I write some test
- I leave
out:
empty - I run test
- I copy-paste "Actual" output and check it to be correct
- Done!
With this format, it will be easier to read, but harder to write.
from pytest-mypy-plugins.
@sobolevn Right, I think that makes sense too, there wouldn't be any need to replace the current format.
Just piling on with some more thoughts here:
Another possible "win" with introducing a higher level of abstraction is that the library could "take the hit" for unstable output from mypy. It would sure take work to implement, but it could possibly be a way forward for addressing issues like #45.
from pytest-mypy-plugins.
This is a nice idea, but I have a few concerns.
This probably requires more knowledge of the internals than I currently have, but I think it might make sense to allow omitting line numbers. I'm proposing that this example would match if there's revealed type on line nine, followed by an error message on any line after that (strictly greater than line 9).
This shouldn't be hard, but at the cost of further cementing match-in-order logic, which is already pretty blunt tool (#77). Also, but it is probably a lesser concern, it could result in false negatives, when
- Expected error doesn't happen.
- Unexpected, but matching error, happens at another line.
Another possible "win" with introducing a higher level of abstraction is that the library could "take the hit" for unstable output from mypy.
At the moment, dealing with changing mypy output is primarily a responsibility of the end users. It is a little bit of pain, but manageable, since you can control mypy version.
In contrast, making more sense out of mypy output within library, might require version specific parser ‒ something that can be hard to maintain, when checker output is not really part of the contract.
Not a big concern in case of the core idea, but can quickly get out of hand if you keep adding features.
from pytest-mypy-plugins.
Another possible "win" with introducing a higher level of abstraction is that the library could "take the hit" for unstable output from mypy. It would sure take work to implement, but it could possibly be a way forward for addressing issues like #45.
@antonagestam I'm also a victim of mypy
changing output string over and over. Well, it's kind of expected when people have to deal with plain text output, but still. Pinning mypy
version as suggested by @zero323 is a way to deal with such problem.
If you are interested in seeing more fine-grained mypy output, you can take a look at python/mypy#10816 and python/mypy#11396. However don't hold your breath for it — given the people involved in the discussion over time, I am fairly confident that mypy
core dev has completely no interest and no intention to make output more accessible.
from pytest-mypy-plugins.
Well, since I am mypy core dev myself, I am pretty interested in this :)
But, this is a complex project that requires quite a lot of details to get it right.
If you have any proposals, please feel free to share them.
from pytest-mypy-plugins.
@abelcheung Oh cool, structured output from mypy directly seems like a much more viable approach.
from pytest-mypy-plugins.
@sobolevn I have a proposal in python/mypy#11396, but there has been zero core dev interaction on that PR. If you can take a look at it, not only will we get structured output but it'll also unlock future endeavours like being able to define a custom output format with a plugin, or to add new fields to the output like exact issue codes.
from pytest-mypy-plugins.
Related Issues (20)
- Getting `project is in the MYPYPATH. Please remove it.` with latest mypy HOT 3
- Test failures using Python 3.11 and Mypy 0.981 HOT 4
- greater-than sign in parametrized values (to check function return values)
- Fails in Python 3.12 due to usage of pkg_resources HOT 3
- sdist is missing tests HOT 5
- chevron is not maintained
- Allow parametrizing `mypy_config`
- Support `--mypy-extra-options` CLI flag
- How to solve Python 3.8/3.9 changes in typing representation HOT 4
- Is there a way to mark `xfail` tests, also with matching output?
- "FileNotFoundError" due to missing "schema.json" after installation
- Add plugin configuration through pyproject.toml? HOT 5
- Ignore mypy errors from site-packages imports HOT 3
- Document cache directory usage
- UnboundLocalError when --mypy-testing-base is not valid
- ERROR pytest.PytestRemovedIn8Warning: The (fspath: py.path.local) argument to YamlTestFile is deprecated. Please use the (path: pathlib.Path) argument instead. HOT 2
- Setting `--python-version` overrides option in `--mypy-ini-file` HOT 1
- mypy_config documentation is confusing HOT 2
- Error formatting hangs indefinitely with `regex: true` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-mypy-plugins.