mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-01-06 05:45:33 +00:00
template: allow test to be run without pytest
Update the PYTHONPATH for standalone runs and pass all command line arguments to pytest main. Also set the executable bit to the python scripts file.
This commit is contained in:
parent
a40daddc4c
commit
b06e9eff75
0
tests/topotests/example-test/__init__.py
Normal file → Executable file
0
tests/topotests/example-test/__init__.py
Normal file → Executable file
11
tests/topotests/example-test/test_template.py
Normal file → Executable file
11
tests/topotests/example-test/test_template.py
Normal file → Executable file
@ -30,6 +30,11 @@ import os
|
||||
import sys
|
||||
import pytest
|
||||
|
||||
# Save the Current Working Directory to find configuration files.
|
||||
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.append(os.path.join(CWD, '../'))
|
||||
|
||||
# pylint: disable=C0413
|
||||
# Import topogen and topotest helpers
|
||||
from lib import topotest
|
||||
from lib.topogen import Topogen, TopoRouter, get_topogen
|
||||
@ -37,9 +42,6 @@ from lib.topogen import Topogen, TopoRouter, get_topogen
|
||||
# Required to instantiate the topology builder class.
|
||||
from mininet.topo import Topo
|
||||
|
||||
# Save the Current Working Directory to find configuration files.
|
||||
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
class TemplateTopo(Topo):
|
||||
"Test topology builder"
|
||||
def build(self, *_args, **_opts):
|
||||
@ -99,4 +101,5 @@ def test_call_mininet_cli():
|
||||
tgen.mininet_cli()
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(pytest.main(["-s"]))
|
||||
args = ["-s"] + sys.argv[1:]
|
||||
sys.exit(pytest.main(args))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user