File: test_api_legacy.py

package info (click to toggle)
python-flake8 7.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,224 kB
  • sloc: python: 6,634; sh: 21; makefile: 19
file content (15 lines) | stat: -rw-r--r-- 469 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Integration tests for the legacy api."""
from __future__ import annotations

from flake8.api import legacy


def test_legacy_api(tmpdir):
    """A basic end-to-end test for the legacy api reporting errors."""
    with tmpdir.as_cwd():
        t_py = tmpdir.join("t.py")
        t_py.write("import os  # unused import\n")

        style_guide = legacy.get_style_guide()
        report = style_guide.check_files([t_py.strpath])
        assert report.total_errors == 1