On 12. 01. 20 16:47, Adam Williamson wrote:
On Sun, 2020-01-12 at 10:02 +0100, Dominik 'Rathann'
Mierzejewski
wrote:
> On Tuesday, 07 January 2020 at 14:32, Fabio Valentini wrote:
>> On Tue, Jan 7, 2020 at 2:18 PM Miro Hrončok <mhroncok(a)redhat.com> wrote:
>>> On 07. 01. 20 14:06, Fabio Valentini wrote:
>>>> - python / pypi works great for %build and %install, but until testing
>>>> with tox is automated in packaging macros, %check has to be specified
>>>> manually since upstream projects do different things there.
>>>> generate_buildrequires also works nicely here.
>>>
>>> See the %tox macro from
https://src.fedoraproject.org/rpms/pyproject-rpm-macros
>>>
>>> Examples:
>>>
>>>
https://src.fedoraproject.org/rpms/python-xmlschema/blob/master/f/python-...
>>>
>>>
https://src.fedoraproject.org/rpms/python-elementpath/blob/master/f/pytho...
>>
>> Ooh, shiny. I knew that somebody was working on this because it was
>> presented at flock, but I didn't know that it was in a usable state
>> now.
>> I'll try using it in the next python package I touch :) Thanks for the
>> pointers, Miro!
>
> Thanks, indeed. Can we have that mentioned in the Python section of the
> Packaging Guidelines?
Please don't mention it as required or even necessarily recommended, as
it may not be. I intentionally set up my projects such that tox is
appropriate for upstream CI, not distribution package checking, and
intend distribution packages to run setup.py test.
The %tox macro runs the tests in current environment.
See
https://github.com/fedora-python/tox-current-env/ for details.
It will probably fail to handle VCS URLs tests dependencies and such, but for
"sane" tox configuration, this works fine.
It is rewuired to have all the dpes, so you can use this to get buildtime +
runtime + tox deps:
%generate_buildrequires
%pyproject_buildrequires -t
(See
https://src.fedoraproject.org/rpms/pyproject-rpm-macros README.)
----
At the same time, `setup.py test` is deprecated.
See for example in python-wikitcms:
https://koji.fedoraproject.org/koji/buildinfo?buildID=1412739
Executing(%check):
...
+ /usr/bin/python3 setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a
future version. Users looking for a generic test entry point independent of
test runner are encouraged to use tox.
---
We have approached "Python (upstream) packaging people" (PyPA etc.) IRL and
asked for a test runner standard. They said: "Use tox, and if you attempt
standardization, build it on tox" (in other words, possibly).
Tox will also soon properly support pyproject.toml config (it does already, but
only in a very ugly way).
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok