blob: 042ed09d42a37ea3e9edf25eaf12855ebf8747b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# -*- coding: utf-8 eval: (yapf-mode 1) -*-
# SPDX-License-Identifier: MIT
#
# August 27 2021, Christian Hopps <chopps@labn.net>
#
# Copyright (c) 2021, LabN Consulting, L.L.C. ("LabN")
import lib.topojson as topojson
import lib.topogen as topogen
from lib.topolog import logger
def tgen_json(request):
logger.info("Creating/starting topogen topology for %s", request.module.__name__)
tgen = topojson.setup_module_from_json(request.module.__file__)
yield tgen
logger.info("Stopping topogen topology for %s", request.module.__name__)
tgen.stop_topology()
def topo(tgen):
"""Make tgen json object available as test argument."""
return tgen.json_topo
def tgen():
"""Make global topogen object available as test argument."""
return topogen.get_topogen()
|