Python 从各种测试文件访问插件定义的数据

Python 从各种测试文件访问插件定义的数据,python,unit-testing,python-2.7,nose,nosetests,Python,Unit Testing,Python 2.7,Nose,Nosetests,我试图在python代码中实现一组运行表单的nose测试 我从这个文件中调用nose-run方法,将其添加到一个自定义插件中,该插件基于: 现在,我想创建一个通用测试用例,从中包含这个场景,这样下面的所有测试都会有一个相同的共享场景。i、 e.-所有从通用案例继承的测试都将基于相同的设置和拆卸方法 以下是常规测试文件: from nose.plugins import Plugin import trex import misc_methods import sys class CTRexGe

我试图在python代码中实现一组运行表单的nose测试

我从这个文件中调用nose-run方法,将其添加到一个自定义插件中,该插件基于:

现在,我想创建一个通用测试用例,从中包含这个场景,这样下面的所有测试都会有一个相同的共享场景。i、 e.-所有从通用案例继承的测试都将基于相同的设置和拆卸方法

以下是常规测试文件:

from nose.plugins import Plugin
import trex
import misc_methods
import sys

class CTRexGeneral_Test():
    """This class defines the general testcase of the T-Rex traffic generator"""

    def setUp(self):
        self.a = CTRexScenario()
        ##### Here I want to config the rest of the scenario, based on the passed configuration file

    def test_can_frobnicate(self):
        assert (self.a.configuration==None)
        # assert 2*5==10

    def tearDown(self):
        pass
不幸的是,我不明白我应该如何访问已经由插件从通用测试文件解析的获取的配置


谢谢

可能是@Oleksiy的重复,问题是,基于配置文件,我正在尝试创建一个需要一定时间的设置过程。这应该在整个测试套件中只发生一次,一旦完成,就需要从每个测试文件访问每个CTRexScenario属性配置、平台等,因为可能需要进行进一步的操作,这是到这些硬件设备的链接。我不确定所提供的链接是否是在全球范围内尝试过的案例,没有提供我想要的
from nose.plugins import Plugin
import trex
import misc_methods
import sys

class CTRexGeneral_Test():
    """This class defines the general testcase of the T-Rex traffic generator"""

    def setUp(self):
        self.a = CTRexScenario()
        ##### Here I want to config the rest of the scenario, based on the passed configuration file

    def test_can_frobnicate(self):
        assert (self.a.configuration==None)
        # assert 2*5==10

    def tearDown(self):
        pass