guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#70570] [PATCH 2/2] guix: pyproject-build-system: Ignore unwanted py


From: Nicolas Graves
Subject: [bug#70570] [PATCH 2/2] guix: pyproject-build-system: Ignore unwanted pytest flags.
Date: Sat, 27 Apr 2024 18:09:39 +0200

On 2024-04-26 12:14, Nicolas Graves wrote:

> On 2024-04-26 10:47, Lars-Dominik Braun wrote:
>
>> Hi,
>>
>> pretty smart idea to use a pytest plugin :)
>>
>>> +;; Pytest plugin to filter out arguments to ignore.
>>> +(define pytest-default-ignore-alist
>>
>> From the comment it’s not entirely clear to me what this list
>> does. It’s a map from pytest plugin name to it’s pytest command line
>> options, right?
>
> Right, I'll update the command.
>
>>
>>> +;; Allow guix to ignore these options when underlying pytest package is not
>>> +;; an input. These flags are not necessary to properly run tests.
>>> +(define (pytest-ignore-options-plugin flags)
>>> +  "This function converts an list of flags in a string that can
>>> +  be instantiated as a python pytest plugin."
>> …
>>> +(define (call-with-guix-pytest-plugin inputs thunk)
>>
>> Same here. As far as I understand you want to emulate command line
>> options provided by pytest plugins, so pytest won’t fail if the plugin
>> is not present. And we only do that if the plugin is not an input to
>> avoid clashing command line options, right?
>
> Will do.
>>
>> +    for option in options:
>> +        group.addoption(option, action='append', nargs='*')"
>>
>> Not sure nargs='*' is a good idea, since it might consume positional
>> arguments intended for pytest. '?' would be a more conservative option,
>> especially since we cannot override this easily per-package.
>
> It works. I'll try with '?' then!
>
>>
>>> +  (let* ((former-path (getenv "PYTHONPATH"))
>> …
>>> +    (dynamic-wind
>>> +      (lambda ()
>>> +        (setenv "PYTHONPATH"
>> …
>>> +      (lambda ()
>>> +        (setenv "PYTHONPATH" former-path)
>>
>> Isn’t it GUIX_PYTHONPATH?
>>
>  
> I know it works this way. Could be GUIX_PYTHONPATH too, I'm not sure I
> properly get the difference. Can test with GUIX_PYTHONPATH too, but in
> any case it's just for the tests, so it should be cleared out
> too. Should I?

Actually, it doesn't seem to work with a replacement from PYTHONPATH to
GUIX_PYTHONPATH, so I would rather keep it this way.

>
>> Lars
>>

-- 
Best regards,
Nicolas Graves





reply via email to

[Prev in Thread] Current Thread [Next in Thread]