Skip to content

Commit

Permalink
Fixes tests that use AnsibleUndefined
Browse files Browse the repository at this point in the history
  • Loading branch information
roverflow committed Dec 17, 2024
1 parent 46a3d71 commit e2c6a8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/unit/plugins/filter/test_ipaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def test_ipaddr_undefined_value(self):
args = ["", AnsibleUndefined(name="my_ip"), ""]
with pytest.raises(
AnsibleFilterError,
match="Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for ipaddr filter <value>",
# Note: this class has been moved to native_helpers dir since 2.16, hence adding regex to be backwards compatable with 2.15
match=r"Unrecognized type <<class 'ansible\.template\.(native_helpers\.)?AnsibleUndefined'>> for ipaddr filter <value>",
):
_ipaddr(*args)

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/filter/test_ipv4.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def test_ipv4_undefined_value(self):
args = ["", AnsibleUndefined(name="my_ip"), ""]
with pytest.raises(
AnsibleFilterError,
match="Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for ipv4 filter <value>",
# Note: this class has been moved to native_helpers dir since 2.16, hence adding regex to be backwards compatable with 2.15
match=r"Unrecognized type <<class 'ansible\.template\.(native_helpers\.)?AnsibleUndefined'>> for ipv4 filter <value>",
):
_ipv4(*args)

Expand Down

0 comments on commit e2c6a8e

Please sign in to comment.