diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index b2f7b1484..7f80d6acb 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -74,7 +74,7 @@ def _get_version_tag(tag): (?P\d+\.\d+(\.\d+)?) """, re.VERBOSE) - match = version_re.match(tag) + match = version_re.fullmatch(tag) if not match: return None @@ -125,7 +125,7 @@ def _get_dictionary_tag(tag): (?Pmust_have_dict|cannot_have_dict)=(?P[a-z]{2}-[A-Z]{2}) """, re.VERBOSE) - match = dict_re.match(tag) + match = dict_re.fullmatch(tag) if not match: return None diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index a0b48ab4b..7accddc03 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -48,7 +48,7 @@ def is_ignored_qt_message(message): """Check if the message is listed in qt_log_ignore.""" regexes = pytest.config.getini('qt_log_ignore') for regex in regexes: - if re.match(regex, message): + if re.search(regex, message): return True return False diff --git a/tests/end2end/fixtures/testprocess.py b/tests/end2end/fixtures/testprocess.py index 570a3125c..eb7123388 100644 --- a/tests/end2end/fixtures/testprocess.py +++ b/tests/end2end/fixtures/testprocess.py @@ -335,7 +335,7 @@ class Process(QObject): if expected is None: return True elif isinstance(expected, regex_type): - return expected.match(value) + return expected.fullmatch(value) elif isinstance(value, (bytes, str)): return utils.pattern_match(pattern=expected, value=value) else: diff --git a/tests/unit/misc/test_checkpyver.py b/tests/unit/misc/test_checkpyver.py index 6487eb263..b61fadc59 100644 --- a/tests/unit/misc/test_checkpyver.py +++ b/tests/unit/misc/test_checkpyver.py @@ -44,7 +44,7 @@ def test_python2(): pytest.skip("python2 not found") assert not proc.stdout stderr = proc.stderr.decode('utf-8') - assert re.match(TEXT, stderr), stderr + assert re.fullmatch(TEXT, stderr), stderr assert proc.returncode == 1 @@ -64,7 +64,7 @@ def test_patched_no_errwindow(capfd, monkeypatch): checkpyver.check_python_version() stdout, stderr = capfd.readouterr() assert not stdout - assert re.match(TEXT, stderr), stderr + assert re.fullmatch(TEXT, stderr), stderr def test_patched_errwindow(capfd, mocker, monkeypatch): diff --git a/tests/unit/utils/test_debug.py b/tests/unit/utils/test_debug.py index e32f564c8..b7b5cf3ca 100644 --- a/tests/unit/utils/test_debug.py +++ b/tests/unit/utils/test_debug.py @@ -90,8 +90,8 @@ class TestLogTime: assert len(caplog.records) == 1 - pattern = re.compile(r'^Foobar took ([\d.]*) seconds\.$') - match = pattern.match(caplog.records[0].msg) + pattern = re.compile(r'Foobar took ([\d.]*) seconds\.') + match = pattern.fullmatch(caplog.records[0].msg) assert match duration = float(match.group(1)) diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index f6eef7f4f..66f5e852d 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -863,7 +863,7 @@ class TestOpenFile: cmdline = '{} -c pass'.format(executable) utils.open_file('/foo/bar', cmdline) result = caplog.records[0].message - assert re.match( + assert re.fullmatch( r'Opening /foo/bar with \[.*python.*/foo/bar.*\]', result) @pytest.mark.not_frozen @@ -872,7 +872,7 @@ class TestOpenFile: cmdline = '{} -c pass {{}} raboof'.format(executable) utils.open_file('/foo/bar', cmdline) result = caplog.records[0].message - assert re.match( + assert re.fullmatch( r"Opening /foo/bar with \[.*python.*/foo/bar.*'raboof'\]", result) @pytest.mark.not_frozen @@ -882,7 +882,7 @@ class TestOpenFile: config_stub.val.downloads.open_dispatcher = cmdline utils.open_file('/foo/bar') result = caplog.records[1].message - assert re.match( + assert re.fullmatch( r"Opening /foo/bar with \[.*python.*/foo/bar.*\]", result) def test_system_default_application(self, caplog, config_stub, mocker): @@ -890,7 +890,7 @@ class TestOpenFile: new_callable=mocker.Mock) utils.open_file('/foo/bar') result = caplog.records[0].message - assert re.match( + assert re.fullmatch( r"Opening /foo/bar with the system application", result) m.assert_called_with(QUrl('file:///foo/bar'))