Exemplo n.º 1
0
    def testGetScripts7(self):
        yamlStr = '\n'.join([
            "{",
            "  example1: {",
            "    test: //src1//,",
            "    script: stack test 1,",
            "  },",
            "  example2: {",
            "    test: //src2//,",
            "    script: stack test 2,",
            "  }",
            "}"
        ])
        configRaw = yaml.load(yamlStr)
        config = convert(configRaw)
        files = [
            'base/src1/path1.hs',
            'base/src1/path2.hs'
        ]

        name1 = config[0]['name']
        expected = [
            notice(name1) + 'stack test 1'
        ]
        actual = getScripts(config, files)
        self.assertCountEqual(expected, actual)
Exemplo n.º 2
0
    def testGetScripts5(self):
        yamlStr = '\n'.join([
            "{",
            "  example: {",
            "    test: /src$/,",
            "    script: stack test,",
            "  }",
            "}"
        ])
        configRaw = yaml.load(yamlStr)
        config = convert(configRaw)
        files = ['base/src/path.hs']

        expected = []
        actual = getScripts(config, files)
        self.assertCountEqual(expected, actual)
Exemplo n.º 3
0
    def testGetScripts4(self):
        yamlStr = '\n'.join([
            "{",
            "  example: {",
            "    test: /^src//,",
            "    script: stack test,",
            "  }",
            "}"
        ])
        configRaw = yaml.load(yamlStr)
        config = convert(configRaw)
        files = ['src/path.hs']

        name = config[0]['name']
        expected = [notice(name) + 'stack test']
        actual = getScripts(config, files)
        self.assertCountEqual(expected, actual)
Exemplo n.º 4
0
        self.tag = None
        self.stage = None

if __name__ == "__main__":
    log("start runTest")

    Env = EnvClass()
    Env.commit = os.environ['TRAVIS_COMMIT']
    Env.commitRange = os.environ['TRAVIS_COMMIT_RANGE']
    Env.branch = os.environ['TRAVIS_BRANCH']
    Env.pullRequest = os.environ['TRAVIS_PULL_REQUEST']
    Env.pullRequestBranch = os.environ['TRAVIS_PULL_REQUEST_BRANCH']
    Env.tag = os.environ['TRAVIS_TAG']
    Env.stage = os.environ['TRAVIS_BUILD_STAGE_NAME']

    config = helper.load(ConfigFile)
    files = gitDiff.getFiles(Env)

    log("changed files: "+str(files))

    scripts = []
    if files == None:
        scripts = helper.getAllScripts(config)
    else:
        scripts = helper.getScripts(config, files)
    res = helper.execScripts(scripts)
    if res:
        exit(0)
    else:
        exit(1)