-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add plugin configuration through pyproject.toml? #133
Comments
Does |
The problem would remain the same. Sorry if my description of the issue is not clear. To put it more simply, I would like to configure This would prevent tests from passing or failing depending on the current working directory, due to the way relative paths are resolved for |
Oh, I see :) |
Great, thanks! I'll work on it. |
Nice! I'm in the process of adding this plugin to the cattrs test suite and I think I want this. To explain my use case: I want to run Mypy only on a single version of Python, say the latest. It's good enough and keeps complexity down. But I need to use So my plan was to install the plugin only on 3.12 and put I'm sure there are other ways of solving this but this seemed like the simplest/most correct to me. |
Hi!
I need a dedicated
mypy.ini
configuration for tests run bypytest-mypy-plugins
. This configuration includes parameters likeforce_uppercase_builtins = true
, which are very useful for unit tests but irrelevant for the entire project.Currently, I can create a separate
mypy-tests.ini
file and runpytest
with the--mypy-ini-file
option. To avoid typing this every time, I can addaddopts = "--mypy-ini-file=mypy-tests.ini"
to mypytest.ini
configuration.However, there is a drawback to this approach: the path is resolved relative to the current working directory, not to
pytest.ini
. This can lead to surprising behavior, where test output changes depending on where thepytest
command was executed. For example, running tests from outside the project's root folder may cause Mypy tests to fail (because it won't use the requiredmypy-tests.ini
file) although all others ran seamlessly.I'd like my tests to be robust in such cases. Pytest itself works flawlessly, so I believe plugins should too. I assume resolving the
--mypy-ini-file
path relative to the "rootdir" is not acceptable for a command-line option. Therefore, it seems appropriate to allow configuration via a file and, in this case, resolve the paths relative to that file. We could even imagine a "override mypy config" entry to avoid the additionalmypy-tests.ini
file in my scenario.What are your thoughts on this?
I've noticed that
pytest-mypy-plugins
already depends ontomlkit
, so I assume implementing this shouldn't be overly complicated.However, I understand if you prefer not to add complexity to the plugin configuration in this way. Yet, If you're open to the idea, I'd be happy to contribute with a PR.
The text was updated successfully, but these errors were encountered: