From c8f20b31cd57443b1bef17579dfceca432420c94 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Tue, 12 May 2020 14:09:40 -0400 Subject: conftest: add docs and tests regarding CiTestCase's subp functionality (#343) And raise TypeError when subp called with no args, which more accurately mirrors normal behaviour: >>> from cloudinit.util import subp >>> subp() Traceback (most recent call last): File "", line 1, in TypeError: subp() missing 1 required positional argument: 'args' --- cloudinit/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cloudinit/conftest.py') diff --git a/cloudinit/conftest.py b/cloudinit/conftest.py index 6a1c63e9..af458c31 100644 --- a/cloudinit/conftest.py +++ b/cloudinit/conftest.py @@ -21,7 +21,9 @@ def disable_subp_usage(request): util.subp(["whoami"]) This fixture (roughly) mirrors the functionality of - CiTestCase.allowed_subp. + CiTestCase.allowed_subp. N.B. While autouse fixtures do affect non-pytest + tests, CiTestCase's allowed_subp does take precedence (and we have + TestDisableSubpUsageInTestSubclass to confirm that). TODO: * Enable select subp usage (i.e. allowed_subp=[...]) -- cgit v1.2.3