mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-14 14:46:57 +00:00
tests: fix missed passing pytestconfig arg
Remove the local ConfigOptionProxy and actually use the munet one. Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
parent
7d12017bd8
commit
1a68b13867
@ -15,13 +15,14 @@ import time
|
|||||||
|
|
||||||
import lib.fixtures
|
import lib.fixtures
|
||||||
import pytest
|
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.topogen import diagnose_env, get_topogen
|
||||||
from lib.topolog import get_test_logdir, logger
|
from lib.topolog import get_test_logdir, logger
|
||||||
from lib.topotest import json_cmp_result
|
from lib.topotest import json_cmp_result
|
||||||
from munet import cli
|
from munet import cli
|
||||||
from munet.base import Commander, proc_error
|
from munet.base import Commander, proc_error
|
||||||
from munet.cleanup import cleanup_current, cleanup_previous
|
from munet.cleanup import cleanup_current, cleanup_previous
|
||||||
|
from munet.config import ConfigOptionsProxy
|
||||||
from munet.testing.util import pause_test
|
from munet.testing.util import pause_test
|
||||||
|
|
||||||
from lib import topolog, topotest
|
from lib import topolog, topotest
|
||||||
|
@ -12,49 +12,6 @@ from munet import cli
|
|||||||
from munet.base import BaseMunet, LinuxNamespace
|
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):
|
class Node(LinuxNamespace):
|
||||||
"""Node (mininet compat)."""
|
"""Node (mininet compat)."""
|
||||||
|
|
||||||
@ -182,7 +139,9 @@ class Mininet(BaseMunet):
|
|||||||
# to set permissions to root:frr 770 to make this unneeded in that case
|
# to set permissions to root:frr 770 to make this unneeded in that case
|
||||||
# os.umask(0)
|
# 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
|
# From munet/munet/native.py
|
||||||
with open(os.path.join(self.rundir, "nspid"), "w", encoding="ascii") as f:
|
with open(os.path.join(self.rundir, "nspid"), "w", encoding="ascii") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user