]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: fix missed passing pytestconfig arg 13373/head
authorChristian Hopps <chopps@labn.net>
Mon, 24 Apr 2023 13:22:42 +0000 (09:22 -0400)
committerChristian Hopps <chopps@labn.net>
Mon, 24 Apr 2023 13:48:26 +0000 (09:48 -0400)
Remove the local ConfigOptionProxy and actually use the munet one.

Signed-off-by: Christian Hopps <chopps@labn.net>
tests/topotests/conftest.py
tests/topotests/lib/micronet_compat.py

index ce59554b1add8d371f5151a30df7196f0037249d..74e308dbc62fee71ed86eee0a577e25505a73cfb 100755 (executable)
@@ -15,13 +15,14 @@ import time
 
 import lib.fixtures
 import pytest
-from lib.micronet_compat import ConfigOptionsProxy, Mininet
+from lib.micronet_compat import Mininet
 from lib.topogen import diagnose_env, get_topogen
 from lib.topolog import get_test_logdir, logger
 from lib.topotest import json_cmp_result
 from munet import cli
 from munet.base import Commander, proc_error
 from munet.cleanup import cleanup_current, cleanup_previous
+from munet.config import ConfigOptionsProxy
 from munet.testing.util import pause_test
 
 from lib import topolog, topotest
index f49db805ba9e246db5463e3df4885dc7a8378439..c5c2adc545bdfa03c7058849099c24534f030571 100644 (file)
@@ -12,49 +12,6 @@ from munet import cli
 from munet.base import BaseMunet, LinuxNamespace
 
 
-def cli_opt_list(option_list):
-    if not option_list:
-        return []
-    if isinstance(option_list, str):
-        return [x for x in option_list.split(",") if x]
-    return [x for x in option_list if x]
-
-
-def name_in_cli_opt_str(name, option_list):
-    ol = cli_opt_list(option_list)
-    return name in ol or "all" in ol
-
-
-class ConfigOptionsProxy:
-    def __init__(self, pytestconfig=None):
-        if isinstance(pytestconfig, ConfigOptionsProxy):
-            self.config = pytestconfig.config
-        else:
-            self.config = pytestconfig
-        self.option = self.config.option
-
-    def getoption(self, opt, defval=None):
-        if not self.config:
-            return defval
-
-        value = self.config.getoption(opt)
-        if value is None:
-            return defval
-
-        return value
-
-    def get_option(self, opt, defval=None):
-        return self.getoption(opt, defval)
-
-    def get_option_list(self, opt):
-        value = self.get_option(opt, "")
-        return cli_opt_list(value)
-
-    def name_in_option_list(self, name, opt):
-        optlist = self.get_option_list(opt)
-        return "all" in optlist or name in optlist
-
-
 class Node(LinuxNamespace):
     """Node (mininet compat)."""
 
@@ -182,7 +139,9 @@ class Mininet(BaseMunet):
         # to set permissions to root:frr 770 to make this unneeded in that case
         # os.umask(0)
 
-        super(Mininet, self).__init__(pid=False, rundir=rundir)
+        super(Mininet, self).__init__(
+            pid=False, rundir=rundir, pytestconfig=pytestconfig
+        )
 
         # From munet/munet/native.py
         with open(os.path.join(self.rundir, "nspid"), "w", encoding="ascii") as f: