Ejemplo n.º 1
0
    def dataProvider_testLoadFile(self):
        yield self.testdir, False, []

        jsonfile = path.join(self.testdir, 'testLoadFile.json')
        helpers.writeFile(
            jsonfile, '\n'.join([
                '{',
                '	"a": "2",',
                '	"a.desc": "Option a",',
                '	"a.type": "int",',
                '	"a.required": true',
                '}',
            ]))
        p1 = Parameter('a', 2)
        p1.desc = "Option a"
        p1.required = True
        yield jsonfile, True, [p1]

        if helpers.moduleInstalled('yaml'):
            yamlfile = path.join(self.testdir, 'testLoadFile.yaml')
            helpers.writeFile(
                yamlfile, '\n'.join([
                    'a: 2',
                    'a.desc: Option a',
                    'a.type: int',
                    'a.required: false',
                    'a.show: true',
                    '',
                ]))
            p2 = Parameter('a', 2)
            p2.desc = "Option a"
            p2.required = False
            p2.show = True
            yield yamlfile, False, [p2]

        conffile = path.join(self.testdir, 'testLoadFile.conf')
        helpers.writeFile(
            conffile, '\n'.join([
                '[PARAM1]',
                'a = 2',
                'a.desc = Option a',
                'a.type = int',
                'a.required = f',
                '[PARAM2]',
                'a.type = str',
                'b:',
                '	1',
                '	2',
                'b.type = list',
            ]))
        p3 = Parameter('a', '2')
        p3.desc = "Option a"
        p3.required = False
        p4 = Parameter('b', ['1', '2'])
        yield conffile, True, [p3, p4]
Ejemplo n.º 2
0
    def dataProvider_testReprStr(self):
        p1 = Parameter('a', 'a')
        p1.required = True
        yield p1,

        p2 = Parameter('b', 'b')
        p2.show = True
        yield p2,

        p3 = Parameter('c', 2)
        p3.desc = 'what'
        yield p3,