Hello community, here is the log from the commit of package python3-flake8 for openSUSE:Factory checked in at 2015-01-10 23:05:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-flake8 (Old) and /work/SRC/openSUSE:Factory/.python3-flake8.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python3-flake8" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-flake8/python3-flake8.changes 2014-07-11 06:46:55.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-flake8.new/python3-flake8.changes 2015-01-10 23:05:33.000000000 +0100 @@ -1,0 +2,33 @@ +Sat Jan 10 02:12:17 UTC 2015 - arun@gmx.de + +- specfile: + * update copyright year + * update url + +- upgrade to version 2.3.0: + * Feature: Add --output-file option to specify a file to write to + instead of stdout. + * Bug Fix interleaving of output while using multiprocessing + (GitLab#17) + +- changes from version 2.2.5: + * Flush standard out when using multiprocessing + * Make the check for "# flake8: noqa" more strict + +- changes from version 2.2.4: + * Fix bugs triggered by turning multiprocessing on by default + (again) + * Multiprocessing is forcibly disabled in the following cases: + + Passing something in via stdin + + Analyzing a diff + + Using windows + * Fix --install-hook when there are no config files present for pep8 + or flake8. + * Fix how the setuptools command parses excludes in config files + * Fix how the git hook determines which files to analyze (Thanks + Chris Buccella!) + +- changes from version 2.2.3: + * Actually turn multiprocessing on by default + +------------------------------------------------------------------- Old: ---- flake8-2.2.2.tar.gz New: ---- flake8-2.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-flake8.spec ++++++ --- /var/tmp/diff_new_pack.9VOjyj/_old 2015-01-10 23:05:34.000000000 +0100 +++ /var/tmp/diff_new_pack.9VOjyj/_new 2015-01-10 23:05:34.000000000 +0100 @@ -1,7 +1,7 @@ # -# spec file for package python-flake8 +# spec file for package python3-flake8 # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -13,15 +13,16 @@ # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Name: python3-flake8 -Version: 2.2.2 +Version: 2.3.0 Release: 0 -License: MIT Summary: Modular source code checker: pep8, pyflakes and co -Url: http://bitbucket.org/tarek/flake8 +License: MIT Group: Development/Languages/Python +Url: https://gitlab.com/pycqa/flake8 Source: http://pypi.python.org/packages/source/f/flake8/flake8-%{version}.tar.gz BuildRequires: python3-devel BuildRequires: python3-distribute ++++++ flake8-2.2.2.tar.gz -> flake8-2.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/CHANGES.rst new/flake8-2.3.0/CHANGES.rst --- old/flake8-2.2.2/CHANGES.rst 2014-07-05 04:50:28.000000000 +0200 +++ new/flake8-2.3.0/CHANGES.rst 2015-01-04 21:48:43.000000000 +0100 @@ -1,6 +1,50 @@ CHANGES ======= +2.3.0 - 2015-01-04 +------------------ + +- **Feature**: Add ``--output-file`` option to specify a file to write to + instead of ``stdout``. + +- **Bug** Fix interleaving of output while using multiprocessing + (`GitLab#17`_) + +.. _GitLab#17: https://gitlab.com/pycqa/flake8/issues/17 + +2.2.5 - 2014-10-19 +------------------ + +- Flush standard out when using multiprocessing + +- Make the check for "# flake8: noqa" more strict + +2.2.4 - 2014-10-09 +------------------ + +- Fix bugs triggered by turning multiprocessing on by default (again) + + Multiprocessing is forcibly disabled in the following cases: + + - Passing something in via stdin + + - Analyzing a diff + + - Using windows + +- Fix --install-hook when there are no config files present for pep8 or + flake8. + +- Fix how the setuptools command parses excludes in config files + +- Fix how the git hook determines which files to analyze (Thanks Chris + Buccella!) + +2.2.3 - 2014-08-25 +------------------ + +- Actually turn multiprocessing on by default + 2.2.2 - 2014-07-04 ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/PKG-INFO new/flake8-2.3.0/PKG-INFO --- old/flake8-2.2.2/PKG-INFO 2014-07-05 04:53:51.000000000 +0200 +++ new/flake8-2.3.0/PKG-INFO 2015-01-04 21:50:23.000000000 +0100 @@ -1,8 +1,8 @@ Metadata-Version: 1.1 Name: flake8 -Version: 2.2.2 +Version: 2.3.0 Summary: the modular source code checker: pep8, pyflakes and co -Home-page: http://bitbucket.org/tarek/flake8 +Home-page: https://gitlab.com/pycqa/flake8 Author: Ian Cordasco Author-email: graffatcolmingov@gmail.com License: MIT @@ -86,6 +86,50 @@ CHANGES ======= + 2.3.0 - 2015-01-04 + ------------------ + + - **Feature**: Add ``--output-file`` option to specify a file to write to + instead of ``stdout``. + + - **Bug** Fix interleaving of output while using multiprocessing + (`GitLab#17`_) + + .. _GitLab#17: https://gitlab.com/pycqa/flake8/issues/17 + + 2.2.5 - 2014-10-19 + ------------------ + + - Flush standard out when using multiprocessing + + - Make the check for "# flake8: noqa" more strict + + 2.2.4 - 2014-10-09 + ------------------ + + - Fix bugs triggered by turning multiprocessing on by default (again) + + Multiprocessing is forcibly disabled in the following cases: + + - Passing something in via stdin + + - Analyzing a diff + + - Using windows + + - Fix --install-hook when there are no config files present for pep8 or + flake8. + + - Fix how the setuptools command parses excludes in config files + + - Fix how the git hook determines which files to analyze (Thanks Chris + Buccella!) + + 2.2.3 - 2014-08-25 + ------------------ + + - Actually turn multiprocessing on by default + 2.2.2 - 2014-07-04 ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/__init__.py new/flake8-2.3.0/flake8/__init__.py --- old/flake8-2.2.2/flake8/__init__.py 2014-07-05 04:51:20.000000000 +0200 +++ new/flake8-2.3.0/flake8/__init__.py 2015-01-04 21:44:40.000000000 +0100 @@ -1 +1 @@ -__version__ = '2.2.2' +__version__ = '2.3.0' Files old/flake8-2.2.2/flake8/__init__.pyc and new/flake8-2.3.0/flake8/__init__.pyc differ Files old/flake8-2.2.2/flake8/_pyflakes.pyc and new/flake8-2.3.0/flake8/_pyflakes.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/callbacks.py new/flake8-2.3.0/flake8/callbacks.py --- old/flake8-2.2.2/flake8/callbacks.py 1970-01-01 01:00:00.000000000 +0100 +++ new/flake8-2.3.0/flake8/callbacks.py 2014-12-27 17:09:11.000000000 +0100 @@ -0,0 +1,27 @@ +import atexit +import sys + + +def install_vcs_hook(option, option_str, value, parser): + # For now, there's no way to affect a change in how pep8 processes + # options. If no args are provided and there's no config file present, + # it will error out because no input was provided. To get around this, + # when we're using --install-hook, we'll say that there were arguments so + # we can actually attempt to install the hook. + # See: https://gitlab.com/pycqa/flake8/issues/2 and + # https://github.com/jcrocholl/pep8/blob/4c5bf00cb613be617c7f48d3b2b82a1c7b895... + # for more context. + parser.values.install_hook = True + parser.rargs.append('.') + + +def restore_stdout(old_stdout): + sys.stdout.close() + sys.stdout = old_stdout + + +def redirect_stdout(option, option_str, value, parser): + fd = open(value, 'w') + old_stdout, sys.stdout = sys.stdout, fd + + atexit.register(restore_stdout, old_stdout) Files old/flake8-2.2.2/flake8/callbacks.pyc and new/flake8-2.3.0/flake8/callbacks.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/engine.py new/flake8-2.3.0/flake8/engine.py --- old/flake8-2.2.2/flake8/engine.py 2014-06-27 14:53:50.000000000 +0200 +++ new/flake8-2.3.0/flake8/engine.py 2014-12-27 17:09:11.000000000 +0100 @@ -5,10 +5,13 @@ import pep8 from flake8 import __version__ +from flake8 import callbacks from flake8.reporter import multiprocessing, BaseQReport, QueueReport -from flake8.util import OrderedSet +from flake8.util import OrderedSet, is_windows, is_using_stdin -_flake8_noqa = re.compile(r'flake8[:=]\s*noqa', re.I).search +_flake8_noqa = re.compile(r'\s*# flake8[:=]\s*noqa', re.I).search + +EXTRA_EXCLUDE = ['.tox', '.eggs', '*.egg'] def _register_extensions(): @@ -17,6 +20,7 @@ extensions.add(('pep8', pep8.__version__)) parser_hooks = [] options_hooks = [] + ignored_hooks = [] try: from pkg_resources import iter_entry_points except ImportError: @@ -30,14 +34,16 @@ parser_hooks.append(checker.add_options) if hasattr(checker, 'parse_options'): options_hooks.append(checker.parse_options) - return extensions, parser_hooks, options_hooks + if getattr(checker, 'off_by_default', False) is True: + ignored_hooks.append(entry.name) + return extensions, parser_hooks, options_hooks, ignored_hooks def get_parser(): """This returns an instance of optparse.OptionParser with all the extensions registered and options set. This wraps ``pep8.get_parser``. """ - (extensions, parser_hooks, options_hooks) = _register_extensions() + (extensions, parser_hooks, options_hooks, ignored) = _register_extensions() details = ', '.join(['%s: %s' % ext for ext in extensions]) python_version = get_python_version() parser = pep8.get_parser('flake8', '%s (%s) %s' % ( @@ -50,22 +56,25 @@ pass if multiprocessing: - try: - auto = multiprocessing.cpu_count() or 1 - except NotImplementedError: - auto = 1 parser.config_options.append('jobs') - parser.add_option('-j', '--jobs', type='string', default='', + parser.add_option('-j', '--jobs', type='string', default='auto', help="number of jobs to run simultaneously, " - "or 'auto'") + "or 'auto'. This is ignored on Windows.") parser.add_option('--exit-zero', action='store_true', help="exit with code 0 even if there are errors") for parser_hook in parser_hooks: parser_hook(parser) - parser.add_option('--install-hook', default=False, action='store_true', + # See comment above regarding why this has to be a callback. + parser.add_option('--install-hook', default=False, dest='install_hook', help='Install the appropriate hook for this ' - 'repository.', dest='install_hook') + 'repository.', action='callback', + callback=callbacks.install_vcs_hook) + parser.add_option('--output-file', default=None, + help='Redirect report to a file.', + type='string', nargs=1, action='callback', + callback=callbacks.redirect_stdout) + parser.ignored_extensions = ignored return parser, options_hooks @@ -77,22 +86,48 @@ print('checking %s' % filename) fchecker = self.checker_class( filename, lines=lines, options=self.options) - # Any "# flake8: noqa" line? + # Any "flake8: noqa" comments to ignore the entire file? if any(_flake8_noqa(line) for line in fchecker.lines): return 0 return fchecker.check_all(expected=expected, line_offset=line_offset) +def _disable_extensions(parser, options): + ignored_extensions = set(getattr(parser, 'ignored_extensions', [])) + # Remove any of the selected extensions from the extensions ignored by + # default. + ignored_extensions -= set(options.select) + # Whatever is left afterwards should be unioned with options.ignore and + # options.ignore should be updated with that. + options.ignore = tuple(ignored_extensions.union(options.ignore)) + + def get_style_guide(**kwargs): - """Parse the options and configure the checker. This returns a sub-class + """Parse the options and configure the checker. This returns a sub-class of ``pep8.StyleGuide``.""" kwargs['parser'], options_hooks = get_parser() styleguide = StyleGuide(**kwargs) options = styleguide.options + + _disable_extensions(kwargs['parser'], options) + + if options.exclude and not isinstance(options.exclude, list): + options.exclude = pep8.normalize_paths(options.exclude) + elif not options.exclude: + options.exclude = [] + + # Add pattersn in EXTRA_EXCLUDE to the list of excluded patterns + options.exclude.extend(pep8.normalize_paths(EXTRA_EXCLUDE)) + for options_hook in options_hooks: options_hook(options) - if multiprocessing and options.jobs: + if options.diff: + options.jobs = None + + force_disable_jobs = is_windows() or is_using_stdin(styleguide.paths) + + if multiprocessing and options.jobs and not force_disable_jobs: if options.jobs.isdigit(): n_jobs = int(options.jobs) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/engine.py.orig new/flake8-2.3.0/flake8/engine.py.orig --- old/flake8-2.2.2/flake8/engine.py.orig 2014-06-27 14:55:46.000000000 +0200 +++ new/flake8-2.3.0/flake8/engine.py.orig 1970-01-01 01:00:00.000000000 +0100 @@ -1,119 +0,0 @@ -# -*- coding: utf-8 -*- -import re -import platform - -import pep8 - -from flake8 import __version__ -from flake8.reporter import multiprocessing, BaseQReport, QueueReport -from flake8.util import OrderedSet - -_flake8_noqa = re.compile(r'flake8[:=]\s*noqa', re.I).search - - -def _register_extensions(): - """Register all the extensions.""" - extensions = OrderedSet() - extensions.add(('pep8', pep8.__version__)) - parser_hooks = [] - options_hooks = [] - try: - from pkg_resources import iter_entry_points - except ImportError: - pass - else: - for entry in iter_entry_points('flake8.extension'): - checker = entry.load() - pep8.register_check(checker, codes=[entry.name]) - extensions.add((checker.name, checker.version)) - if hasattr(checker, 'add_options'): - parser_hooks.append(checker.add_options) - if hasattr(checker, 'parse_options'): - options_hooks.append(checker.parse_options) - return extensions, parser_hooks, options_hooks - - -def get_parser(): - """This returns an instance of optparse.OptionParser with all the - extensions registered and options set. This wraps ``pep8.get_parser``. - """ - (extensions, parser_hooks, options_hooks) = _register_extensions() - details = ', '.join(['%s: %s' % ext for ext in extensions]) - python_version = get_python_version() - parser = pep8.get_parser('flake8', '%s (%s) %s' % ( - __version__, details, python_version - )) - for opt in ('--repeat', '--testsuite', '--doctest'): - try: - parser.remove_option(opt) - except ValueError: - pass - - if multiprocessing: - try: - auto = multiprocessing.cpu_count() or 1 - except NotImplementedError: - auto = 1 - parser.config_options.append('jobs') - parser.add_option('-j', '--jobs', type='string', default='', - help="number of jobs to run simultaneously, " - "or 'auto'") - - parser.add_option('--exit-zero', action='store_true', - help="exit with code 0 even if there are errors") - for parser_hook in parser_hooks: - parser_hook(parser) - parser.add_option('--install-hook', default=False, action='store_true', - help='Install the appropriate hook for this ' - 'repository.', dest='install_hook') - return parser, options_hooks - - -class StyleGuide(pep8.StyleGuide): - - def input_file(self, filename, lines=None, expected=None, line_offset=0): - """Run all checks on a Python source file.""" - if self.options.verbose: - print('checking %s' % filename) - fchecker = self.checker_class( - filename, lines=lines, options=self.options) - # Any "# flake8: noqa" line? - if any(_flake8_noqa(line) for line in fchecker.lines): - return 0 - return fchecker.check_all(expected=expected, line_offset=line_offset) - - -def get_style_guide(**kwargs): - """Parse the options and configure the checker. This returns a sub-class - of ``pep8.StyleGuide``.""" - kwargs['parser'], options_hooks = get_parser() - styleguide = StyleGuide(**kwargs) - options = styleguide.options - for options_hook in options_hooks: - options_hook(options) - - if multiprocessing and options.jobs: - if options.jobs.isdigit(): - n_jobs = int(options.jobs) - else: - try: - n_jobs = multiprocessing.cpu_count() - except NotImplementedError: - n_jobs = 1 - if n_jobs > 1: - options.jobs = n_jobs - reporter = BaseQReport if options.quiet else QueueReport - report = styleguide.init_report(reporter) - report.input_file = styleguide.input_file - styleguide.runner = report.task_queue.put - - return styleguide - - -def get_python_version(): - # The implementation isn't all that important. - try: - impl = platform.python_implementation() + " " - except AttributeError: # Python 2.5 - impl = '' - return '%s%s on %s' % (impl, platform.python_version(), platform.system()) Files old/flake8-2.2.2/flake8/engine.pyc and new/flake8-2.3.0/flake8/engine.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/hooks.py new/flake8-2.3.0/flake8/hooks.py --- old/flake8-2.2.2/flake8/hooks.py 2014-05-23 02:55:54.000000000 +0200 +++ new/flake8-2.3.0/flake8/hooks.py 2014-10-20 03:47:15.000000000 +0200 @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import with_statement import os +import pep8 import sys import stat from subprocess import Popen, PIPE @@ -47,10 +48,9 @@ if complexity > -1: options['max_complexity'] = complexity - files_modified = [f for f in files_modified if f.endswith('.py')] - flake8_style = get_style_guide(config_file=DEFAULT_CONFIG, paths=['.'], **options) + filepatterns = flake8_style.options.filename # Copy staged versions to temporary directory tmpdir = mkdtemp() @@ -72,7 +72,12 @@ # write staged version of file to temporary directory with open(filename, "wb") as fh: fh.write(out) - files_to_check.append(filename) + + # check_files() only does this check if passed a dir; so we do it + if ((pep8.filename_match(filename, filepatterns) and + not flake8_style.excluded(filename))): + files_to_check.append(filename) + # Run the checks report = flake8_style.check_files(files_to_check) # remove temporary directory Files old/flake8-2.2.2/flake8/hooks.pyc and new/flake8-2.3.0/flake8/hooks.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/main.py new/flake8-2.3.0/flake8/main.py --- old/flake8-2.2.2/flake8/main.py 2014-05-23 02:55:54.000000000 +0200 +++ new/flake8-2.3.0/flake8/main.py 2014-12-18 02:29:56.000000000 +0100 @@ -15,7 +15,7 @@ 'flake8' ) -EXTRA_IGNORE = ['.tox'] +EXTRA_IGNORE = [] def main(): @@ -32,7 +32,8 @@ report = flake8_style.check_files() exit_code = print_report(report, flake8_style) - raise SystemExit(exit_code > 0) + if exit_code > 0: + raise SystemExit(exit_code > 0) def print_report(report, flake8_style): Files old/flake8-2.2.2/flake8/main.pyc and new/flake8-2.3.0/flake8/main.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/reporter.py new/flake8-2.3.0/flake8/reporter.py --- old/flake8-2.2.2/flake8/reporter.py 2014-07-05 04:52:13.000000000 +0200 +++ new/flake8-2.3.0/flake8/reporter.py 2014-12-27 17:09:11.000000000 +0100 @@ -2,6 +2,7 @@ # Adapted from a contribution of Johan Dahlin import collections +import re import sys try: import multiprocessing @@ -30,29 +31,54 @@ # Work around http://bugs.python.org/issue10845 sys.modules['__main__'].__file__ = __file__ - def start(self): - super(BaseQReport, self).start() - self.__class__._loaded = True - # spawn processes - for i in range(self.n_jobs): - p = multiprocessing.Process(target=self.process_main) - p.start() + def _cleanup_queue(self, queue): + while not queue.empty(): + queue.get_nowait() - def stop(self): + def _put_done(self): # collect queues for i in range(self.n_jobs): self.task_queue.put('DONE') self.update_state(self.result_queue.get()) - super(BaseQReport, self).stop() - def process_main(self): + def _process_main(self): if not self._loaded: # Windows needs to parse again the configuration from flake8.main import get_style_guide, DEFAULT_CONFIG get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG) for filename in iter(self.task_queue.get, 'DONE'): self.input_file(filename) - self.result_queue.put(self.get_state()) + + def start(self): + super(BaseQReport, self).start() + self.__class__._loaded = True + # spawn processes + for i in range(self.n_jobs): + p = multiprocessing.Process(target=self.process_main) + p.daemon = True + p.start() + + def stop(self): + try: + self._put_done() + except KeyboardInterrupt: + pass + finally: + # cleanup queues to unlock threads + self._cleanup_queue(self.result_queue) + self._cleanup_queue(self.task_queue) + super(BaseQReport, self).stop() + + def process_main(self): + try: + self._process_main() + except KeyboardInterrupt: + pass + finally: + # ensure all output is flushed before main process continues + sys.stdout.flush() + sys.stderr.flush() + self.result_queue.put(self.get_state()) def get_state(self): return {'total_errors': self.total_errors, @@ -68,3 +94,34 @@ class QueueReport(pep8.StandardReport, BaseQReport): """Standard Queue Report.""" + + def get_file_results(self): + """Print the result and return the overall count for this file.""" + self._deferred_print.sort() + + for line_number, offset, code, text, doc in self._deferred_print: + print(self._fmt % { + 'path': self.filename, + 'row': self.line_offset + line_number, 'col': offset + 1, + 'code': code, 'text': text, + }) + # stdout is block buffered when not stdout.isatty(). + # line can be broken where buffer boundary since other processes + # write to same file. + # flush() after print() to avoid buffer boundary. + # Typical buffer size is 8192. line written safely when + # len(line) < 8192. + sys.stdout.flush() + if self._show_source: + if line_number > len(self.lines): + line = '' + else: + line = self.lines[line_number - 1] + print(line.rstrip()) + sys.stdout.flush() + print(re.sub(r'\S', ' ', line[:offset]) + '^') + sys.stdout.flush() + if self._show_pep8 and doc: + print(' ' + doc.strip()) + sys.stdout.flush() + return self.file_errors Files old/flake8-2.2.2/flake8/reporter.pyc and new/flake8-2.3.0/flake8/reporter.pyc differ Files old/flake8-2.2.2/flake8/tests/__init__.pyc and new/flake8-2.3.0/flake8/tests/__init__.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/tests/test_engine.py new/flake8-2.3.0/flake8/tests/test_engine.py --- old/flake8-2.2.2/flake8/tests/test_engine.py 2014-06-27 14:54:08.000000000 +0200 +++ new/flake8-2.3.0/flake8/tests/test_engine.py 2014-12-27 17:09:11.000000000 +0100 @@ -1,9 +1,12 @@ from __future__ import with_statement import unittest -import mock +try: + from unittest import mock +except ImportError: + import mock # < PY33 -from flake8 import engine, util, __version__ +from flake8 import engine, util, __version__, reporter class TestEngine(unittest.TestCase): @@ -25,7 +28,7 @@ def test_get_style_guide(self): with mock.patch('flake8.engine._register_extensions') as reg_ext: - reg_ext.return_value = ([], [], []) + reg_ext.return_value = ([], [], [], []) g = engine.get_style_guide() self.assertTrue(isinstance(g, engine.StyleGuide)) reg_ext.assert_called_once_with() @@ -34,6 +37,7 @@ m = mock.Mock() with mock.patch('flake8.engine.StyleGuide') as StyleGuide: with mock.patch('flake8.engine.get_parser') as get_parser: + m.ignored_extensions = [] StyleGuide.return_value.options.jobs = '42' get_parser.return_value = (m, []) engine.get_style_guide(foo='bar') @@ -55,7 +59,8 @@ gpv = self.start_patch('flake8.engine.get_python_version') pgp = self.start_patch('pep8.get_parser') m = mock.Mock() - re.return_value = ([('pyflakes', '0.7'), ('mccabe', '0.2')], [], []) + re.return_value = ([('pyflakes', '0.7'), ('mccabe', '0.2')], [], [], + []) gpv.return_value = 'Python Version' pgp.return_value = m # actual call we're testing @@ -79,5 +84,32 @@ # Also we can never be sure (without reconstructing the string # ourselves) what system we may be testing on. + def test_windows_disables_jobs(self): + with mock.patch('flake8.engine.is_windows') as is_windows: + is_windows.return_value = True + guide = engine.get_style_guide() + assert isinstance(guide, reporter.BaseQReport) is False + + def test_stdin_disables_jobs(self): + with mock.patch('flake8.engine.is_using_stdin') as is_using_stdin: + is_using_stdin.return_value = True + guide = engine.get_style_guide() + assert isinstance(guide, reporter.BaseQReport) is False + + def test_disables_extensions_that_are_not_selected(self): + with mock.patch('flake8.engine._register_extensions') as re: + re.return_value = ([('fake_ext', '0.1a1')], [], [], ['X']) + sg = engine.get_style_guide() + assert 'X' in sg.options.ignore + + def test_enables_off_by_default_extensions(self): + with mock.patch('flake8.engine._register_extensions') as re: + re.return_value = ([('fake_ext', '0.1a1')], [], [], ['X']) + parser, options = engine.get_parser() + parser.parse_args(['--select=X']) + sg = engine.StyleGuide(parser=parser) + assert 'X' not in sg.options.ignore + + if __name__ == '__main__': unittest.main() Files old/flake8-2.2.2/flake8/tests/test_engine.pyc and new/flake8-2.3.0/flake8/tests/test_engine.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/tests/test_integration.py new/flake8-2.3.0/flake8/tests/test_integration.py --- old/flake8-2.2.2/flake8/tests/test_integration.py 1970-01-01 01:00:00.000000000 +0100 +++ new/flake8-2.3.0/flake8/tests/test_integration.py 2014-12-18 02:29:56.000000000 +0100 @@ -0,0 +1,71 @@ +from __future__ import with_statement + +import os +import unittest +try: + from unittest import mock +except ImportError: + import mock # < PY33 + +from flake8 import engine + + +class IntegrationTestCase(unittest.TestCase): + """Integration style tests to exercise different command line options.""" + + def this_file(self): + """Return the real path of this file.""" + this_file = os.path.realpath(__file__) + if this_file.endswith("pyc"): + this_file = this_file[:-1] + return this_file + + def check_files(self, arglist=[], explicit_stdin=False, count=0): + """Call check_files.""" + if explicit_stdin: + target_file = "-" + else: + target_file = self.this_file() + argv = ['flake8'] + arglist + [target_file] + with mock.patch("sys.argv", argv): + style_guide = engine.get_style_guide(parse_argv=True) + report = style_guide.check_files() + self.assertEqual(report.total_errors, count) + return style_guide, report + + def test_no_args(self): + # assert there are no reported errors + self.check_files() + + def _job_tester(self, jobs): + # mock stdout.flush so we can count the number of jobs created + with mock.patch('sys.stdout.flush') as mocked: + guide, report = self.check_files(arglist=['--jobs=%s' % jobs]) + self.assertEqual(guide.options.jobs, jobs) + self.assertEqual(mocked.call_count, jobs) + + def test_jobs(self): + self._job_tester(2) + self._job_tester(10) + + def test_stdin(self): + self.count = 0 + + def fake_stdin(): + self.count += 1 + with open(self.this_file(), "r") as f: + return f.read() + + with mock.patch("pep8.stdin_get_value", fake_stdin): + guide, report = self.check_files(arglist=['--jobs=4'], + explicit_stdin=True) + self.assertEqual(self.count, 1) + + def test_stdin_fail(self): + def fake_stdin(): + return "notathing\n" + with mock.patch("pep8.stdin_get_value", fake_stdin): + # only assert needed is in check_files + guide, report = self.check_files(arglist=['--jobs=4'], + explicit_stdin=True, + count=1) Files old/flake8-2.2.2/flake8/tests/test_integration.pyc and new/flake8-2.3.0/flake8/tests/test_integration.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8/util.py new/flake8-2.3.0/flake8/util.py --- old/flake8-2.2.2/flake8/util.py 2013-07-26 18:06:37.000000000 +0200 +++ new/flake8-2.3.0/flake8/util.py 2014-09-13 16:16:36.000000000 +0200 @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import os try: import ast @@ -43,6 +44,16 @@ return val.upper() in ('1', '0', 'F', 'T', 'TRUE', 'FALSE', 'ON', 'OFF') +def is_windows(): + """Determine if the system is Windows.""" + return os.name == 'nt' + + +def is_using_stdin(paths): + """Determine if we're running checks on stdin.""" + return '-' in paths + + def flag_on(val): """Return true if flag is on""" return str(val).upper() in ('1', 'T', 'TRUE', 'ON') Files old/flake8-2.2.2/flake8/util.pyc and new/flake8-2.3.0/flake8/util.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8.egg-info/PKG-INFO new/flake8-2.3.0/flake8.egg-info/PKG-INFO --- old/flake8-2.2.2/flake8.egg-info/PKG-INFO 2014-07-05 04:53:51.000000000 +0200 +++ new/flake8-2.3.0/flake8.egg-info/PKG-INFO 2015-01-04 21:50:23.000000000 +0100 @@ -1,8 +1,8 @@ Metadata-Version: 1.1 Name: flake8 -Version: 2.2.2 +Version: 2.3.0 Summary: the modular source code checker: pep8, pyflakes and co -Home-page: http://bitbucket.org/tarek/flake8 +Home-page: https://gitlab.com/pycqa/flake8 Author: Ian Cordasco Author-email: graffatcolmingov@gmail.com License: MIT @@ -86,6 +86,50 @@ CHANGES ======= + 2.3.0 - 2015-01-04 + ------------------ + + - **Feature**: Add ``--output-file`` option to specify a file to write to + instead of ``stdout``. + + - **Bug** Fix interleaving of output while using multiprocessing + (`GitLab#17`_) + + .. _GitLab#17: https://gitlab.com/pycqa/flake8/issues/17 + + 2.2.5 - 2014-10-19 + ------------------ + + - Flush standard out when using multiprocessing + + - Make the check for "# flake8: noqa" more strict + + 2.2.4 - 2014-10-09 + ------------------ + + - Fix bugs triggered by turning multiprocessing on by default (again) + + Multiprocessing is forcibly disabled in the following cases: + + - Passing something in via stdin + + - Analyzing a diff + + - Using windows + + - Fix --install-hook when there are no config files present for pep8 or + flake8. + + - Fix how the setuptools command parses excludes in config files + + - Fix how the git hook determines which files to analyze (Thanks Chris + Buccella!) + + 2.2.3 - 2014-08-25 + ------------------ + + - Actually turn multiprocessing on by default + 2.2.2 - 2014-07-04 ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8.egg-info/SOURCES.txt new/flake8-2.3.0/flake8.egg-info/SOURCES.txt --- old/flake8-2.2.2/flake8.egg-info/SOURCES.txt 2014-07-05 04:53:51.000000000 +0200 +++ new/flake8-2.3.0/flake8.egg-info/SOURCES.txt 2015-01-04 21:50:23.000000000 +0100 @@ -10,10 +10,12 @@ flake8/__main__.py flake8/_pyflakes.py flake8/_pyflakes.pyc +flake8/callbacks.py +flake8/callbacks.pyc flake8/engine.py -flake8/engine.py.orig flake8/engine.pyc flake8/hooks.py +flake8/hooks.pyc flake8/main.py flake8/main.pyc flake8/reporter.py @@ -30,4 +32,6 @@ flake8/tests/__init__.py flake8/tests/__init__.pyc flake8/tests/test_engine.py -flake8/tests/test_engine.pyc \ No newline at end of file +flake8/tests/test_engine.pyc +flake8/tests/test_integration.py +flake8/tests/test_integration.pyc \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/flake8.egg-info/entry_points.txt new/flake8-2.3.0/flake8.egg-info/entry_points.txt --- old/flake8-2.2.2/flake8.egg-info/entry_points.txt 2014-07-05 04:53:51.000000000 +0200 +++ new/flake8-2.3.0/flake8.egg-info/entry_points.txt 2015-01-04 21:50:23.000000000 +0100 @@ -1,9 +1,9 @@ -[flake8.extension] -F = flake8._pyflakes:FlakesChecker - [console_scripts] flake8 = flake8.main:main [distutils.commands] flake8 = flake8.main:Flake8Command +[flake8.extension] +F = flake8._pyflakes:FlakesChecker + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/setup.cfg new/flake8-2.3.0/setup.cfg --- old/flake8-2.2.2/setup.cfg 2014-07-05 04:53:51.000000000 +0200 +++ new/flake8-2.3.0/setup.cfg 2015-01-04 21:50:23.000000000 +0100 @@ -2,7 +2,7 @@ universal = 1 [egg_info] -tag_build = tag_date = 0 +tag_build = tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-2.2.2/setup.py new/flake8-2.3.0/setup.py --- old/flake8-2.2.2/setup.py 2014-06-23 04:19:34.000000000 +0200 +++ new/flake8-2.3.0/setup.py 2014-10-20 03:47:15.000000000 +0200 @@ -8,6 +8,18 @@ except ImportError: pass +try: + # Use https://docs.python.org/3/library/unittest.mock.html + from unittest import mock +except ImportError: + # < Python 3.3 + mock = None + + +tests_require = ['nose'] +if mock is None: + tests_require += ['mock'] + def get_version(fname='flake8/__init__.py'): with open(fname) as f: @@ -34,7 +46,7 @@ author_email="tarek@ziade.org", maintainer="Ian Cordasco", maintainer_email="graffatcolmingov@gmail.com", - url="http://bitbucket.org/tarek/flake8", + url="https://gitlab.com/pycqa/flake8", packages=["flake8", "flake8.tests"], install_requires=[ "pyflakes >= 0.8.1", @@ -58,6 +70,6 @@ "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance", ], - tests_require=['nose', 'mock'], + tests_require=tests_require, test_suite='nose.collector', ) -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org