mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 14:54:17 +00:00
Update tests after last night's refactor
This commit is contained in:
parent
f20d44565b
commit
559922dbbc
2 changed files with 18 additions and 26 deletions
|
|
@ -119,8 +119,7 @@ def test_parse_args_normalize_paths(optmanager):
|
||||||
|
|
||||||
def test_format_plugin():
|
def test_format_plugin():
|
||||||
"""Verify that format_plugin turns a tuple into a dictionary."""
|
"""Verify that format_plugin turns a tuple into a dictionary."""
|
||||||
plugin = manager.OptionManager.format_plugin(('T101', 'Testing', '0.0.0'))
|
plugin = manager.OptionManager.format_plugin(('Testing', '0.0.0'))
|
||||||
assert plugin['entry'] == 'T101'
|
|
||||||
assert plugin['name'] == 'Testing'
|
assert plugin['name'] == 'Testing'
|
||||||
assert plugin['version'] == '0.0.0'
|
assert plugin['version'] == '0.0.0'
|
||||||
|
|
||||||
|
|
@ -128,9 +127,9 @@ def test_format_plugin():
|
||||||
def test_generate_versions(optmanager):
|
def test_generate_versions(optmanager):
|
||||||
"""Verify a comma-separated string is generated of registered plugins."""
|
"""Verify a comma-separated string is generated of registered plugins."""
|
||||||
optmanager.registered_plugins = [
|
optmanager.registered_plugins = [
|
||||||
('T100', 'Testing 100', '0.0.0'),
|
('Testing 100', '0.0.0'),
|
||||||
('T101', 'Testing 101', '0.0.0'),
|
('Testing 101', '0.0.0'),
|
||||||
('T300', 'Testing 300', '0.0.0'),
|
('Testing 300', '0.0.0'),
|
||||||
]
|
]
|
||||||
assert (optmanager.generate_versions() ==
|
assert (optmanager.generate_versions() ==
|
||||||
'Testing 100: 0.0.0, Testing 101: 0.0.0, Testing 300: 0.0.0')
|
'Testing 100: 0.0.0, Testing 101: 0.0.0, Testing 300: 0.0.0')
|
||||||
|
|
@ -138,14 +137,13 @@ def test_generate_versions(optmanager):
|
||||||
|
|
||||||
def test_generate_versions_with_format_string(optmanager):
|
def test_generate_versions_with_format_string(optmanager):
|
||||||
"""Verify a comma-separated string is generated of registered plugins."""
|
"""Verify a comma-separated string is generated of registered plugins."""
|
||||||
optmanager.registered_plugins = [
|
optmanager.registered_plugins.update([
|
||||||
('T100', 'Testing', '0.0.0'),
|
('Testing', '0.0.0'),
|
||||||
('T101', 'Testing', '0.0.0'),
|
('Testing', '0.0.0'),
|
||||||
('T300', 'Testing', '0.0.0'),
|
('Testing', '0.0.0'),
|
||||||
]
|
])
|
||||||
assert (
|
assert (
|
||||||
optmanager.generate_versions('%(name)s(%(entry)s): %(version)s') ==
|
optmanager.generate_versions() == 'Testing: 0.0.0'
|
||||||
'Testing(T100): 0.0.0, Testing(T101): 0.0.0, Testing(T300): 0.0.0'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -155,9 +153,9 @@ def test_update_version_string(optmanager):
|
||||||
assert optmanager.parser.version == TEST_VERSION
|
assert optmanager.parser.version == TEST_VERSION
|
||||||
|
|
||||||
optmanager.registered_plugins = [
|
optmanager.registered_plugins = [
|
||||||
('T100', 'Testing 100', '0.0.0'),
|
('Testing 100', '0.0.0'),
|
||||||
('T101', 'Testing 101', '0.0.0'),
|
('Testing 101', '0.0.0'),
|
||||||
('T300', 'Testing 300', '0.0.0'),
|
('Testing 300', '0.0.0'),
|
||||||
]
|
]
|
||||||
|
|
||||||
optmanager.update_version_string()
|
optmanager.update_version_string()
|
||||||
|
|
@ -172,14 +170,14 @@ def test_generate_epilog(optmanager):
|
||||||
assert optmanager.parser.epilog is None
|
assert optmanager.parser.epilog is None
|
||||||
|
|
||||||
optmanager.registered_plugins = [
|
optmanager.registered_plugins = [
|
||||||
('T100', 'Testing 100', '0.0.0'),
|
('Testing 100', '0.0.0'),
|
||||||
('T101', 'Testing 101', '0.0.0'),
|
('Testing 101', '0.0.0'),
|
||||||
('T300', 'Testing 300', '0.0.0'),
|
('Testing 300', '0.0.0'),
|
||||||
]
|
]
|
||||||
|
|
||||||
expected_value = (
|
expected_value = (
|
||||||
'Installed plugins: Testing 100(T100): 0.0.0, Testing 101(T101): '
|
'Installed plugins: Testing 100: 0.0.0, Testing 101: 0.0.0, Testing'
|
||||||
'0.0.0, Testing 300(T300): 0.0.0'
|
' 300: 0.0.0'
|
||||||
)
|
)
|
||||||
|
|
||||||
optmanager.generate_epilog()
|
optmanager.generate_epilog()
|
||||||
|
|
|
||||||
|
|
@ -114,12 +114,6 @@ def test_register_options():
|
||||||
|
|
||||||
# Assert that we call add_options
|
# Assert that we call add_options
|
||||||
plugin_obj.add_options.assert_called_once_with(option_manager)
|
plugin_obj.add_options.assert_called_once_with(option_manager)
|
||||||
# Assert that we register the plugin
|
|
||||||
option_manager.register_plugin.assert_called_once_with(
|
|
||||||
entry_point_name='T000',
|
|
||||||
version=plugin_obj.version,
|
|
||||||
name=plugin_obj.name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_register_options_checks_plugin_for_method():
|
def test_register_options_checks_plugin_for_method():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue