summaryrefslogtreecommitdiff
path: root/cloudinit/tests/helpers.py
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-05-12 14:09:40 -0400
committerGitHub <noreply@github.com>2020-05-12 14:09:40 -0400
commitc8f20b31cd57443b1bef17579dfceca432420c94 (patch)
tree15801b7d0d08dc130c4e71024ad4481b32aa63e8 /cloudinit/tests/helpers.py
parentd10ce3ecfe89d7ec2a69bdbd109b100090698ded (diff)
downloadvyos-cloud-init-c8f20b31cd57443b1bef17579dfceca432420c94.tar.gz
vyos-cloud-init-c8f20b31cd57443b1bef17579dfceca432420c94.zip
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 "<stdin>", line 1, in <module> TypeError: subp() missing 1 required positional argument: 'args'
Diffstat (limited to 'cloudinit/tests/helpers.py')
-rw-r--r--cloudinit/tests/helpers.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py
index 477e14c2..b0af54c1 100644
--- a/cloudinit/tests/helpers.py
+++ b/cloudinit/tests/helpers.py
@@ -144,6 +144,9 @@ class CiTestCase(TestCase):
if 'args' in kwargs:
cmd = kwargs['args']
else:
+ if not args:
+ raise TypeError(
+ "subp() missing 1 required positional argument: 'args'")
cmd = args[0]
if not isinstance(cmd, str):