Skip to content
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

[BR]: Several tests fail with Python 3.11 #3260

Closed
1 of 3 tasks
hobbes1069 opened this issue Apr 17, 2022 · 2 comments
Closed
1 of 3 tasks

[BR]: Several tests fail with Python 3.11 #3260

hobbes1069 opened this issue Apr 17, 2022 · 2 comments
Labels

Comments

@hobbes1069
Copy link

Environment:

  • Fail2Ban version : 0.11.2
  • OS, including release name/version : Fedora Rawhide (future f37)
  • Fail2Ban installed via OS/distribution mechanisms
  • You have not applied any additional foreign patches to the codebase
  • Some customizations were done to the configuration (provide details below is so)

The issue:

Global inline flags (e.g. (?i)) can now only be used at the start of the regular expressions. Using them not at the start of expression was deprecated since Python 3.6. (Contributed by Serhiy Storchaka in bpo-47066.)

Any additional information

Full build logs, to jump to the tests search for %check:
https://hobbes1069.fedorapeople.org/build.log

Any customizations done to /etc/fail2ban/ configuration

The beginnings of a patch for Python 3.11:

Index: fail2ban-0.11.2/fail2ban/tests/actiontestcase.py
===================================================================
--- fail2ban-0.11.2.orig/fail2ban/tests/actiontestcase.py
+++ fail2ban-0.11.2/fail2ban/tests/actiontestcase.py
@@ -244,14 +244,14 @@ class CommandActionTest(LogCaptureTestCa
        setattr(self.__action, 'ab', "<ac>")
        setattr(self.__action, 'x?family=inet6', "")
        # produce self-referencing properties except:
-       self.assertRaisesRegexp(ValueError, r"properties contain self referencing definitions",
+       self.assertRaisesRegex(ValueError, r"properties contain self referencing definitions",
            lambda: self.__action.replaceTag("<a><b>",
                self.__action._properties, conditional="family=inet4")
        )
        # remore self-referencing in props:
        delattr(self.__action, 'ac')
        # produce self-referencing query except:
-       self.assertRaisesRegexp(ValueError, r"possible self referencing definitions in query",
+       self.assertRaisesRegex(ValueError, r"possible self referencing definitions in query",
            lambda: self.__action.replaceTag("<x"*30+">"*30,
                self.__action._properties, conditional="family=inet6")
        )
@sebres
Copy link
Contributor

sebres commented Jun 21, 2022

fixed in #3267

@sebres sebres closed this as completed Jun 21, 2022
@sebres
Copy link
Contributor

sebres commented Jun 21, 2022

merged in 0.11 (c6cfd76) and 1.0 (3c22ae1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants