Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug(tests): mock reads of host's /sys/class/net via get_sys_class_path
Avoid leaking reads to the underlying host's /sys/class/net files. Some test environments contain virtual network hardware and configuration such as Calico network devices which provide duplicated MAC addresses for each device in /sys/class/net. This results in errors from unittests calling cloudinit.net.get_interfaces. Provide a disable_sysfs_net` fixture and use it in net-related modules or functions to avoid unrelated test failures due to environmental differences. Provide the ability to turn off this fixture for tests which need to write to the mocked sysfs tmp directory so test artifacts do not pollute other tests. This fixture can be disabled by passing False to the disable_sysfs_net via request.param. We want to avoid polluting tox.ini with pytest.marks for infrequently used cases like this. Also fix whitespace in tox.ini
- Loading branch information