mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 12:36:54 +00:00
improve integration tests
This commit is contained in:
parent
a7de34a90e
commit
bbbe0d8048
4 changed files with 61 additions and 35 deletions
|
|
@ -1,5 +1,6 @@
|
|||
"""Integration tests for plugin loading."""
|
||||
from flake8.main import application
|
||||
from flake8.main.cli import main
|
||||
|
||||
LOCAL_PLUGIN_CONFIG = "tests/fixtures/config_files/local-plugin.ini"
|
||||
LOCAL_PLUGIN_PATH_CONFIG = "tests/fixtures/config_files/local-plugin-path.ini"
|
||||
|
|
@ -65,3 +66,32 @@ def test_enable_local_plugin_at_non_installed_path():
|
|||
|
||||
assert app.check_plugins is not None
|
||||
assert app.check_plugins["XE"].plugin.name == "ExtensionTestPlugin2"
|
||||
|
||||
|
||||
class AlwaysErrors:
|
||||
name = "AlwaysError"
|
||||
version = "1"
|
||||
|
||||
def __init__(self, tree):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
yield 1, 0, "ABC123 error", type(self)
|
||||
|
||||
|
||||
def test_plugin_gets_enabled_by_default(tmp_path, capsys):
|
||||
cfg_s = f"""\
|
||||
[flake8:local-plugins]
|
||||
extension =
|
||||
ABC = {AlwaysErrors.__module__}:{AlwaysErrors.__name__}
|
||||
"""
|
||||
cfg = tmp_path.joinpath("tox.ini")
|
||||
cfg.write_text(cfg_s)
|
||||
|
||||
t_py = tmp_path.joinpath("t.py")
|
||||
t_py.touch()
|
||||
|
||||
assert main((str(t_py), "--config", str(cfg))) == 1
|
||||
out, err = capsys.readouterr()
|
||||
assert out == f"{t_py}:1:1: ABC123 error\n"
|
||||
assert err == ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue