]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/munet/compat.py
1 # -*- coding: utf-8 eval: (blacken-mode 1) -*-
2 # SPDX-License-Identifier: GPL-2.0-or-later
4 # November 16 2022, Christian Hopps <chopps@labn.net>
6 # Copyright (c) 2022, LabN Consulting, L.L.C.
8 """Provide compatible APIs."""
12 """Pytest config duck-type-compatible object using argprase args."""
15 """A namespace defined by a dictionary of values."""
17 def __init__(self
, args
):
20 def __getattr__(self
, attr
):
21 return self
.args
[attr
] if attr
in self
.args
else None
23 def __init__(self
, args
):
24 self
.args
= vars(args
)
25 self
.option
= PytestConfig
.Namespace(self
.args
)
27 def getoption(self
, name
, default
=None, skip
=False):
29 if name
.startswith("--"):
31 name
= name
.replace("-", "_")
33 return self
.args
[name
] if self
.args
[name
] is not None else default