示例#1
0
    def teardown_test_environment(self, **kwargs):
        files = [path for path in self.static_files_iterator()]
        if self.to_file:
            fmt = 'lint-xml'
        else:
            fmt = 'text'

        if files:
            cmd = ['csslint', '--format=%s' % fmt] + files

            if self.ignore:
                cmd += ['--ignore=%s' % self.ignore]

            process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
            output, err = process.communicate()
            retcode = process.poll()
            if retcode not in [0, 1]:  # normal csslint return codes
                raise CalledProcessError(retcode, cmd,
                                         output=output + '\n' + err)

            self.output.write(output.decode('utf-8'))
        elif self.to_file:
            self.output.write('<?xml version="1.0" encoding='
                              '"utf-8"?><lint></lint>')

        self.output.close()
示例#2
0
    def teardown_test_environment(self, **kwargs):
        files = [path for path in self.static_files_iterator()]

        cmd = ['jshint']
        if self.to_file:
            cmd += ['--jslint-reporter']
        cmd += files

        process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
        output, err = process.communicate()
        retcode = process.poll()
        if retcode not in [0, 2]:  # normal jshint return codes
            raise CalledProcessError(retcode, cmd, output=output + '\n' + err)

        self.output.write(output.decode('utf-8'))
示例#3
0
    def teardown_test_environment(self, **kwargs):
        files = [relpath(path) for path in self.static_files_iterator()]
        if self.to_file:
            fmt = 'lint-xml'
        else:
            fmt = 'text'

        if files:
            cmd = [self.interpreter, self.implementation, '--format=%s' % fmt] + files

            process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
            output, err = process.communicate()
            retcode = process.poll()
            if retcode not in [0, 1]: # normal csslint return codes
                raise CalledProcessError(retcode, cmd, output=output + '\n' + err)

            self.output.write(output)
        elif self.to_file:
            self.output.write('<csslint></csslint')