From 3e8c8cd5361bd33865e8d685f4af8c32c839d5e9 Mon Sep 17 00:00:00 2001 From: Alexander Sowitzki Date: Wed, 13 Jan 2021 18:33:03 +0100 Subject: [PATCH] Make `test_adhoc` succeed from within a git checkout The test currently only expects the literal `ansible` followed by a semver in the first output line of `ansible --version`. When running from within a git checkout, additional information like the currently checkout branch are attached, which lets the test fail. This commit allows arbitrary information to follow the semver. --- test/units/cli/test_adhoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/units/cli/test_adhoc.py b/test/units/cli/test_adhoc.py index 6f1dfb0f1f3..75cbc32713f 100644 --- a/test/units/cli/test_adhoc.py +++ b/test/units/cli/test_adhoc.py @@ -105,7 +105,7 @@ def test_ansible_version(capsys, mocker): version_lines = version[0].splitlines() assert len(version_lines) == 9, 'Incorrect number of lines in "ansible --version" output' - assert re.match('ansible [0-9.a-z]+$', version_lines[0]), 'Incorrect ansible version line in "ansible --version" output' + assert re.match('ansible [0-9.a-z]+(?: .*)?$', version_lines[0]), 'Incorrect ansible version line in "ansible --version" output' assert re.match(' config file = .*$', version_lines[1]), 'Incorrect config file line in "ansible --version" output' assert re.match(' configured module search path = .*$', version_lines[2]), 'Incorrect module search path in "ansible --version" output' assert re.match(' ansible python module location = .*$', version_lines[3]), 'Incorrect python module location in "ansible --version" output'