diff options
author | James Falcon <james.falcon@canonical.com> | 2021-12-15 20:16:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 19:16:38 -0700 |
commit | bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf (patch) | |
tree | 1fbb3269fc87e39832e3286ef42eefd2b23fcd44 /tests/unittests/distros/test_networking.py | |
parent | 2bcf4fa972fde686c2e3141c58e640640b44dd00 (diff) | |
download | vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.tar.gz vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.zip |
Adopt Black and isort (SC-700) (#1157)
Applied Black and isort, fixed any linting issues, updated tox.ini
and CI.
Diffstat (limited to 'tests/unittests/distros/test_networking.py')
-rw-r--r-- | tests/unittests/distros/test_networking.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/tests/unittests/distros/test_networking.py b/tests/unittests/distros/test_networking.py index ec508f4d..635f6901 100644 --- a/tests/unittests/distros/test_networking.py +++ b/tests/unittests/distros/test_networking.py @@ -1,3 +1,6 @@ +# See https://docs.pytest.org/en/stable/example +# /parametrize.html#parametrizing-conditional-raising +from contextlib import ExitStack as does_not_raise from unittest import mock import pytest @@ -9,10 +12,6 @@ from cloudinit.distros.networking import ( Networking, ) -# See https://docs.pytest.org/en/stable/example -# /parametrize.html#parametrizing-conditional-raising -from contextlib import ExitStack as does_not_raise - @pytest.yield_fixture def generic_networking_cls(): @@ -35,7 +34,8 @@ def generic_networking_cls(): error = AssertionError("Unexpectedly used /sys in generic networking code") with mock.patch( - "cloudinit.net.get_sys_class_path", side_effect=error, + "cloudinit.net.get_sys_class_path", + side_effect=error, ): yield TestNetworking @@ -91,8 +91,10 @@ class TestLinuxNetworkingTrySetLinkUp: m_is_up.return_value = True is_success = LinuxNetworking().try_set_link_up(devname) - assert (mock.call(['ip', 'link', 'set', devname, 'up']) == - m_subp.call_args_list[-1]) + assert ( + mock.call(["ip", "link", "set", devname, "up"]) + == m_subp.call_args_list[-1] + ) assert is_success def test_calls_subp_return_false(self, m_subp, m_is_up): @@ -100,8 +102,10 @@ class TestLinuxNetworkingTrySetLinkUp: m_is_up.return_value = False is_success = LinuxNetworking().try_set_link_up(devname) - assert (mock.call(['ip', 'link', 'set', devname, 'up']) == - m_subp.call_args_list[-1]) + assert ( + mock.call(["ip", "link", "set", devname, "up"]) + == m_subp.call_args_list[-1] + ) assert not is_success @@ -153,7 +157,9 @@ class TestNetworkingWaitForPhysDevs: return netcfg def test_skips_settle_if_all_present( - self, generic_networking_cls, wait_for_physdevs_netcfg, + self, + generic_networking_cls, + wait_for_physdevs_netcfg, ): networking = generic_networking_cls() with mock.patch.object( @@ -169,7 +175,9 @@ class TestNetworkingWaitForPhysDevs: assert 0 == m_settle.call_count def test_calls_udev_settle_on_missing( - self, generic_networking_cls, wait_for_physdevs_netcfg, + self, + generic_networking_cls, + wait_for_physdevs_netcfg, ): networking = generic_networking_cls() with mock.patch.object( |