The documentation here:
https://docs.pytest.org/en/latest/goodpractices.html#integrating-with-setuptools-python-setup-py-test-pytest-runner
states that pytest-runner should be listed in setup-requires, but I think it should be listed in tests_require, since it's not required for setup to function, right?
GitMate.io thinks the contributor most likely able to help you is @nicoddemus.
@jonathanunderwood thanks for bringing this up!
Your statement makes sense, but listing it in setup_requires is what's suggested by pytest-runner on its README.
I see python-lz4/python-lz4#78 has been merged, has that worked well for you guys?
@jaraco can you confirm if it should go into setup_requires or tests_require?
I see python-lz4/python-lz4#78 has been merged, has that worked well for you guys?
Yes, works fine.
pytest-runner needs to be defined in setup_requires, because as it is a setuptools plugin, it must be installed and available very early, and setup_requires is the only place where that happens. Defining it in tests_requires serves only as documentation and won't have any behavioral effect.
Thanks @jaraco!
@jonathanunderwood so it seems the documentation is actually correct.
I'm closing this as "working as intended" then, feel free to followup with any questions though.
pytest-runner needs to be defined in setup_requires, because as it is a setuptools plugin, it must be installed and available very early, and setup_requires is the only place where that happens.
Thanks for this simple exlanation. I think it would be worth adding this to the docs, as it's non-obvious this is the case (both me and the person who submitted the lz4 PR had had the same thought).
Most helpful comment
pytest-runner needs to be defined in setup_requires, because as it is a setuptools plugin, it must be installed and available very early, and setup_requires is the only place where that happens. Defining it in
tests_requiresserves only as documentation and won't have any behavioral effect.