On Sat, Nov 11, 2023 at 11:40 PM Dumitru Ceara <[email protected]> wrote:

> Without this, when using Python 3.12 and flake8 5.0.4, the following
> errors are flagged:
>   tests/check_acl_log.py:97:25: E231 missing whitespace after ':'
>   tests/check_acl_log.py:102:71: E231 missing whitespace after ':'
>
> While this seems a bit too restrictive from flake8 we can easily work
> around it by just not using f-strings unless necessary.
>
> This unblocks GitHub CI runs on branches <= 23.06.  These started
> failing since the Python version we get in CI (in the Ubuntu runner)
> changed to CPython (3.12.0).
>
> Signed-off-by: Dumitru Ceara <[email protected]>
> ---
> NOTE: this patch should be backported to all supported branches.
> ---
>  tests/check_acl_log.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/check_acl_log.py b/tests/check_acl_log.py
> index 0c1968b2eb..ed98044f77 100644
> --- a/tests/check_acl_log.py
> +++ b/tests/check_acl_log.py
> @@ -94,12 +94,14 @@ def main():
>                  print(
>                      f"Expected log {key}={val} but got "
>                      f"{key}={parsed_log[key]} "
> -                    f"in:\n\t'{acl_log}'"
> +                    "in:\n\t"
> +                    f"'{acl_log}'"
>                  )
>                  exit(1)
>          except KeyError:
>              print(
> -                f"Expected log {key}={val} but {key} does not exist in:\n"
> +                f"Expected log {key}={val} but {key} "
> +                "does not exist in:\n"
>                  f"\t'{acl_log}'"
>              )
>              exit(1)
> --
> 2.39.3
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Hi Dumitru,

thank you for the patch. It seems that we are not the first ones to run
into that issue [0]. It doesn't seem right to "bend" f-strings because of
that. All we need apparently is to upgrade pycodestyle past 2.11.

Thanks,
Ales

[0] https://github.com/PyCQA/flake8/issues/1845

-- 

Ales Musil

Senior Software Engineer - OVN Core

Red Hat EMEA <https://www.redhat.com>

[email protected]
<https://red.ht/sig>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to