Merge branch 'mr/164' into 'master'

Make `flake8 --version` reproducible between invocations

Closes #297

See merge request !169
This commit is contained in:
Ian Cordasco 2017-01-21 20:19:55 +00:00
commit c1f9dc7241
3 changed files with 28 additions and 2 deletions

View file

@ -19,9 +19,14 @@ You can view the `3.3.0 milestone`_ on GitLab for more details.
- Added unique error codes for all missing PyFlakes messages (14 new
codes, see all :ref:`Error / Violation Codes <error_codes>`)
.. links
- Force ``flake8 --version`` to be repeatable between invocations. (See also
`GitLab#297`_)
.. all links
.. _3.3.0 milestone:
https://gitlab.com/pycqa/flake8/milestones/16
.. issue links
.. _GitLab#244:
https://gitlab.com/pycqa/flake8/issues/244
.. _GitLab#251:
@ -30,5 +35,9 @@ You can view the `3.3.0 milestone`_ on GitLab for more details.
https://gitlab.com/pycqa/flake8/issues/268
.. _GitLab#290:
https://gitlab.com/pycqa/flake8/issues/290
.. _GitLab#297:
https://gitlab.com/pycqa/flake8/issues/297
.. merge request links
.. _GitLab!156:
https://gitlab.com/pycqa/flake8/merge_requests/156

View file

@ -245,7 +245,7 @@ class OptionManager(object):
"""Generate a comma-separated list of versions of plugins."""
return join_on.join(
format_str % self.format_plugin(plugin)
for plugin in self.registered_plugins
for plugin in sorted(self.registered_plugins)
)
def update_version_string(self):

View file

@ -137,6 +137,23 @@ def test_generate_versions(optmanager):
'Testing 100: 0.0.0, Testing 101: 0.0.0, Testing 300: 0.0.0')
def test_plugins_are_sorted_in_generate_versions(optmanager):
"""Verify we sort before joining strings in generate_versions."""
optmanager.registered_plugins = [
('pyflakes', '1.5.0'),
('mccabe', '0.7.0'),
('pycodestyle', '2.2.0'),
('flake8-docstrings', '0.6.1'),
('flake8-bugbear', '2016.12.1'),
]
assert (optmanager.generate_versions() ==
'flake8-bugbear: 2016.12.1, '
'flake8-docstrings: 0.6.1, '
'mccabe: 0.7.0, '
'pycodestyle: 2.2.0, '
'pyflakes: 1.5.0')
def test_generate_versions_with_format_string(optmanager):
"""Verify a comma-separated string is generated of registered plugins."""
optmanager.registered_plugins.update([