tests, integ: fix TypeError on dns tests
With pytest-4.6.9 or later version, pytest will fail with: ``` state = {'dns-resolver': {'config': {'search': [], 'server': MarkDecorator(mark=Mark(name='xfail', args=(['2001:4860:4860::888...: 'eth1'}, {'destination': '::/0', 'metric': 201, 'next-hop-address': '2001:db8:2::f', 'next-hop-interface': 'eth1'}]}} def validate_dns(state): """ Only support at most 2 name servers now: https://nmstate.atlassian.net/browse/NMSTATE-220 """ dns_servers = ( state.get(DNS.KEY, {}).get(DNS.CONFIG, {}).get(DNS.SERVER, []) ) > if len(dns_servers) > 3: E TypeError: object of type 'MarkDecorator' has no len() ``` In order to fix this, this patch is using the suggested format by pytest documentation https://docs.pytest.org/en/latest/skipping.html#skip-xfail-with-parametrize. Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
This commit is contained in:
parent
471ef1d941
commit
b4bc868fbe
@ -107,16 +107,22 @@ def test_dns_edit_ipv6_nameserver_before_ipv4():
|
||||
[
|
||||
(IPV4_DNS_NAMESERVERS + [EXTRA_IPV4_DNS_NAMESERVER]),
|
||||
(IPV6_DNS_NAMESERVERS + [EXTRA_IPV6_DNS_NAMESERVER]),
|
||||
pytest.mark.xfail(
|
||||
reason="Not supported",
|
||||
raises=NmstateNotImplementedError,
|
||||
strict=True,
|
||||
)(IPV4_DNS_NAMESERVERS + [EXTRA_IPV6_DNS_NAMESERVER]),
|
||||
pytest.mark.xfail(
|
||||
reason="Not supported",
|
||||
raises=NmstateNotImplementedError,
|
||||
strict=True,
|
||||
)(IPV6_DNS_NAMESERVERS + [EXTRA_IPV4_DNS_NAMESERVER]),
|
||||
pytest.param(
|
||||
(IPV4_DNS_NAMESERVERS + [EXTRA_IPV6_DNS_NAMESERVER]),
|
||||
marks=pytest.mark.xfail(
|
||||
reason="Not supported",
|
||||
raises=NmstateNotImplementedError,
|
||||
strict=True,
|
||||
),
|
||||
),
|
||||
pytest.param(
|
||||
(IPV6_DNS_NAMESERVERS + [EXTRA_IPV4_DNS_NAMESERVER]),
|
||||
marks=pytest.mark.xfail(
|
||||
reason="Not supported",
|
||||
raises=NmstateNotImplementedError,
|
||||
strict=True,
|
||||
),
|
||||
),
|
||||
],
|
||||
ids=["ipv4", "ipv6", "ipv4+ipv6", "ipv6+ipv4"],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user