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
documentation contradiction: pytest_load_initial_conftests #4482
Comments
After struggling with the documentation linked in the OP I've found a workaround for my use case. I will have For such a scenario I've added the following snippet to my
Per the xdist documentation this will automatically determine how many cores to distribute my tests to. This produces the expected output:
|
It's indeed a mistake, the file comment even refers setup tools, the description however contest |
@RonnyPfannschmidt yeah, I tracked down the PRs where those comments where introduced and didn't find any additional instruction on what I needed to do as a user to enable this behavior. Rather than try and figure out how to setup a setuptools plugin I went with the above approach instead. Again, for my use case, this solves my problem completely! |
it's about 3 hours I'm trying to get this working without any success. |
It seems like pytest doesn't allow passing options at run time, or at least I haven't find a way after almost a day of looking. Having the documentation being incorrect certainly didn't help. This wouldn't be that much of an issue if there was an easy way to provide big configurations, but it seems the only thing that works is command line options or the ini file, which is pretty much the same since you can only use My use-case is fairly simple: an integration test of embedded firmware using RPCs over UART. This requires quite a bit of configuration like the name and UART ports of at least 2 devices. Putting all of this in a single line in an ini file is a bit ridiculous. |
For anyone needing to parallelize on default but also needing to override on occasion, @dogonthehorizon's comment is a great option as running |
I think there is a contradiction between this example page in the documentation and the reference of
pytest_load_initial_conftests
.https://docs.pytest.org/en/latest/example/simple.html#dynamically-adding-command-line-options
https://docs.pytest.org/en/latest/reference.html#_pytest.hookspec.pytest_load_initial_conftests
The examples page suggests that it can be used to " dynamically modify the command line arguments ". But the reference says
This hook will not be called for conftest.py files, only for setuptools plugins.
The examples page doesn't mention anything about setuptools plugins and it gives the impression that it can be used from conftest files, like other examples from the same page.
The text was updated successfully, but these errors were encountered: