def teardown_test_environment(self, **kwargs):
        # Get the list of PROJECT_APPS if nothing specified any we don't want everything
        if len(self.test_labels) < 1 and not self.options['all_applications']:
            under = get_apps_under_test(self.test_labels, self.options['all_applications'])
            self.test_labels = [label.split('.')[-1] for label in under]

        call_command('graph_models', *self.test_labels, **self.options)
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options["test_all"])
        self.output_dir = options["output_dir"]
        self.with_migrations = options.get(
            "coverage_with_migrations", getattr(settings, "COVERAGE_WITH_MIGRATIONS", False)
        )

        self.html_dir = options.get("coverage_html_report_dir") or getattr(
            settings, "COVERAGE_REPORT_HTML_OUTPUT_DIR", ""
        )

        self.branch = options.get("coverage_measure_branch", getattr(settings, "COVERAGE_MEASURE_BRANCH", True))

        self.exclude_locations = []
        modnames = options.get("coverage_excludes") or getattr(settings, "COVERAGE_EXCLUDES", [])
        for modname in modnames:
            try:
                self.exclude_locations.append(os.path.dirname(import_module(modname).__file__))
            except ImportError:
                pass

        # Extra folders to exclude. Particularly useful to specify things like
        # apps/company/migrations/*
        self.exclude_locations.extend(getattr(settings, "COVERAGE_EXCLUDES_FOLDERS", []))
        # import ipdb; ipdb.set_trace()

        self.coverage = coverage(
            branch=self.branch,
            source=self.test_apps,
            omit=self.exclude_locations,
            config_file=options.get("coverage_rcfile") or Task.default_config_path(),
        )
Beispiel #3
0
    def teardown_test_environment(self, **kwargs):        
        args = ["--rcfile=%s" % self.config_path] 
        if self.errors_only:
            args += ['--errors-only']
        args += get_apps_under_test(self.test_labels, self.test_all)

        lint.Run(args, reporter=ParseableTextReporter(output=self.output), exit=False)

        return True
Beispiel #4
0
    def teardown_test_environment(self, **kwargs):
        # Get the list of PROJECT_APPS if nothing specified any we don't
        # want everything
        if len(self.test_labels) < 1 and not self.options['all_applications']:
            under = get_apps_under_test(self.test_labels,
                                        self.options['all_applications'])
            self.test_labels = [label.split('.')[-1] for label in under]

        call_command('graph_models', *self.test_labels, **self.options)
Beispiel #5
0
    def teardown_test_environment(self, **kwargs):
        args = ["--rcfile=%s" % self.config_path]
        if self.errors_only:
            args += ['--errors-only']
        args += get_apps_under_test(self.test_labels, self.test_all)
        reporter = UnicodeFriendlyReporter(output=self.output)
        reporter.set_output_encoding('utf-8')
        lint.Run(args, reporter=reporter, exit=False)

        return True
 def __init__(self, test_labels, options):
     super(Task, self).__init__(test_labels, options)
     self.test_apps = get_apps_under_test(test_labels, options['test_all'])
     self.output_dir = options['output_dir']
     self.excludes = options['coverage_excludes']
     self.html_dir = options['coverage_html_report_dir']
     
     self.coverage = coverage(branch = options['coverage_measure_branch'],
                              source = test_labels or None,
                              config_file = options.get('coverage_rcfile', Task.default_config_path))
Beispiel #7
0
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options['test_all'])
        self.output_dir = options['output_dir']
        self.excludes = options['coverage_excludes']
        self.html_dir = options['coverage_html_report_dir']

        self.coverage = coverage(branch=options['coverage_measure_branch'],
                                 source=test_labels or None,
                                 config_file=options['coverage_rcfile']
                                 or Task.default_config_path())
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options["test_all"])
        self.output_dir = options["output_dir"]
        self.excludes = options["coverage_excludes"]
        self.html_dir = options["coverage_html_report_dir"]

        self.coverage = coverage(
            branch=options["coverage_measure_branch"],
            source=test_labels or None,
            config_file=options["coverage_rcfile"] or Task.default_config_path(),
        )
Beispiel #9
0
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options['test_all'])
        self.output_dir = options['output_dir']
        self.html_dir = options['coverage_html_report_dir']

        self.exclude_locations = []
        for modname in options['coverage_excludes']:
            try:
                self.exclude_locations.append(os.path.dirname(import_module(modname).__file__))
            except ImportError:
                pass

        self.coverage = coverage(branch=options['coverage_measure_branch'],
                                 source=self.test_apps,
                                 config_file=options['coverage_rcfile'] or Task.default_config_path())
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options['test_all'])
        self.output_dir = options['output_dir']
        self.html_dir = options['coverage_html_report_dir']

        self.exclude_locations = []
        for modname in options['coverage_excludes']:
            try:
                self.exclude_locations.append(
                    os.path.dirname(import_module(modname).__file__))
            except ImportError:
                pass

        self.coverage = coverage(branch=options['coverage_measure_branch'],
                                 source=self.test_apps,
                                 config_file=options['coverage_rcfile']
                                 or Task.default_config_path())
Beispiel #11
0
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options['test_all'])
        self.output_dir = options['output_dir']
        self.with_migrations = options.get('coverage_with_migrations',
                                    getattr(settings,
                                            'COVERAGE_WITH_MIGRATIONS', False))

        self.html_dir = options.get('coverage_html_report_dir') or \
                            getattr(settings,
                                    'COVERAGE_REPORT_HTML_OUTPUT_DIR', '')

        self.branch = options.get('coverage_measure_branch',
                                  getattr(settings,
                                          'COVERAGE_MEASURE_BRANCH', True))

        self.exclude_locations = []
        modnames = options.get('coverage_excludes') or \
                        getattr(settings, 'COVERAGE_EXCLUDES', [])
        for modname in modnames:
            try:
                self.exclude_locations.append(
                        os.path.dirname(
                            import_module(modname).__file__
                        )
                )
            except ImportError:
                pass

        # Extra folders to exclude. Particularly useful to specify things like
        # apps/company/migrations/*
        self.exclude_locations.extend(
                        getattr(settings, 'COVERAGE_EXCLUDES_FOLDERS', []))

        omit = self.exclude_locations
        if not omit:
            omit = None

        self.coverage = coverage(branch=self.branch,
                                 source=self.test_apps,
                                 omit=omit,
                                 config_file=options.get('coverage_rcfile') or
                                                 Task.default_config_path())
Beispiel #12
0
    def teardown_test_environment(self, **kwargs):
        locations = [os.path.dirname(get_app(app_name.split('.')[-1]).__file__) \
                     for app_name in get_apps_under_test(self.test_labels, self.test_all)]
        pep8.process_options(self.pep8_options + locations)

        # run pep8 tool with captured output
        def report_error(instance, line_number, offset, text, check):
            code = text[:4]
            if pep8.ignore_code(code):
                return
            filepath = relpath(instance.filename)
            message = re.sub(r'([WE]\d+)', r'[\1] PEP8:', text)
            sourceline = instance.line_offset + line_number
            self.output.write('%s:%s: %s\n' % (filepath, sourceline, message))
        pep8.Checker.report_error = report_error

        for location in locations:
            pep8.input_dir(location, runner=pep8.input_file)

        self.output.close()
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options['test_all'])
        self.output_dir = options['output_dir']
        self.with_migrations = options.get('coverage_with_migrations',
                                    getattr(settings,
                                            'COVERAGE_WITH_MIGRATIONS', False))

        self.html_dir = options.get('coverage_html_report_dir') or \
                            getattr(settings,
                                    'COVERAGE_REPORT_HTML_OUTPUT_DIR', '')

        self.branch = options.get('coverage_measure_branch',
                                  getattr(settings,
                                          'COVERAGE_MEASURE_BRANCH', True))

        self.exclude_locations = []
        modnames = options.get('coverage_excludes') or \
                        getattr(settings, 'COVERAGE_EXCLUDES', [])
        for modname in modnames:
            try:
                self.exclude_locations.append(
                        os.path.dirname(
                            import_module(modname).__file__
                        )
                )
            except ImportError:
                pass

        # Extra folders to exclude. Particularly useful to specify things like
        # apps/company/migrations/*
        self.exclude_locations.extend(
                        getattr(settings, 'COVERAGE_EXCLUDES_FOLDERS', []))
        #import ipdb; ipdb.set_trace()

        self.coverage = Coverage(branch=self.branch,
                                 source=self.test_apps,
                                 omit=self.exclude_locations,
                                 config_file=options.get('coverage_rcfile') or
                                                 Task.default_config_path())
Beispiel #14
0
    def __init__(self, test_labels, options):
        super(Task, self).__init__(test_labels, options)
        self.test_apps = get_apps_under_test(test_labels, options['test_all'])
        self.output_dir = options['output_dir']
        self.with_migrations = options.get('coverage_with_migrations',
                                           getattr(settings, 'COVERAGE_WITH_MIGRATIONS', False))
        self.html_dir = options.get('coverage_html_report_dir',
                                    getattr(settings, 'COVERAGE_REPORT_HTML_OUTPUT_DIR', ''))
        self.branch = options.get('coverage_measure_branch',
                                  getattr(settings, 'COVERAGE_MEASURE_BRANCH', True))

        self.exclude_locations = []
        for modname in options.get('coverage_excludes',
                                   getattr(settings, 'COVERAGE_EXCLUDES', [])):
            try:
                self.exclude_locations.append(os.path.dirname(import_module(modname).__file__))
            except ImportError:
                pass

        self.coverage = coverage(branch=self.branch,
                                 source=self.test_apps,
                                 config_file=options.get('coverage_rcfile') or Task.default_config_path())
Beispiel #15
0
    def teardown_test_environment(self, **kwargs):
        locations = [
            os.path.dirname(get_app(app_name.split(".")[-1]).__file__)
            for app_name in get_apps_under_test(self.test_labels, self.test_all)
        ]
        pep8.process_options(self.pep8_options + locations)

        # run pep8 tool with captured output
        def report_error(instance, line_number, offset, text, check):
            code = text[:4]
            if pep8.ignore_code(code):
                return
            filepath = relpath(instance.filename)
            message = re.sub(r"([WE]\d+)", r"[\1] PEP8:", text)
            sourceline = instance.line_offset + line_number
            self.output.write("%s:%s: %s\n" % (filepath, sourceline, message))

        pep8.Checker.report_error = report_error

        for location in locations:
            pep8.input_dir(location, runner=pep8.input_file)

        self.output.close()