Coverage for tests / unit / tools / core / conftest.py: 56%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Fixtures for tools/core tests.""" 

2 

3from __future__ import annotations 

4 

5from pathlib import Path 

6 

7import pytest 

8 

9 

10@pytest.fixture 

11def temp_python_file(tmp_path: Path) -> Path: 

12 """Create a temporary Python file with long lines for testing. 

13 

14 Args: 

15 tmp_path: Pytest's built-in temporary path fixture. 

16 

17 Returns: 

18 Path: Path to the temporary Python file. 

19 """ 

20 file_path = tmp_path / "test_file.py" 

21 # Create a file with lines of varying lengths 

22 # NOTE: Long lines below are intentional test data for E501 detection 

23 content = '''"""Test module.""" 

24 

25x = 1 

26y = 2 

27 

28# This is a long comment line that definitely exceeds the 88 character limit and should trigger E501 detection 

29long_string = "This is a very long string literal that definitely exceeds the 88 character limit for testing purposes" 

30''' # noqa: E501 

31 file_path.write_text(content) 

32 return file_path