]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
allow test to require an env var to be set
authorJason Ish <ish@unx.ca>
Wed, 20 Dec 2017 17:25:13 +0000 (11:25 -0600)
committerJason Ish <ish@unx.ca>
Wed, 20 Dec 2017 17:25:13 +0000 (11:25 -0600)
Useful for only enabling tests when an environment
variable is set.

run.py

diff --git a/run.py b/run.py
index 94fd7118731be633319d9dc138bbcca016690e11..9bffd8dcc0f0ef71bf30e9656eb1241ee5955840 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -100,6 +100,12 @@ class TestConfig:
                         raise UnsatisfiedRequirementError(
                             "not for feature %s" % (feature))
 
+            if "env" in requires:
+                for env in requires["env"]:
+                    if not env in os.environ:
+                        raise UnsatisfiedRequirementError(
+                            "requires env var %s" % (env))
+
     def has_command(self):
         return "command" in self.config