1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
from pathlib import (
Path)
import pytest
from pathspec.util import (
iter_tree_files)
@pytest.fixture(scope='session')
def cpython_dir() -> Path:
return Path("~/Downloads/cpython").expanduser()
@pytest.fixture(scope='session')
def cpython_files(cpython_dir: Path) -> set[str]:
return set(iter_tree_files(cpython_dir))
@pytest.fixture(scope='session')
def cpython_gi_file(cpython_dir: Path) -> Path:
return cpython_dir / ".gitignore"
@pytest.fixture(scope='session')
def cpython_gi_lines_all(cpython_gi_file: Path) -> list[str]:
return [
__line for __line in cpython_gi_file.read_text().splitlines()
if __line and not __line.startswith('#')
]
@pytest.fixture(scope='session')
def cpython_gi_lines_1(cpython_gi_lines_all: list[str]) -> list[str]:
return [
"*.cover",
]
@pytest.fixture(scope='session')
def cpython_gi_lines_5(cpython_gi_lines_all: list[str]) -> list[str]:
return [
"*.cover",
"*.iml",
"Modules/config.c",
"CLAUDE.local.md",
"Doc/data/python*.abi",
]
@pytest.fixture(scope='session')
def cpython_gi_lines_15(cpython_gi_lines_all: list[str]) -> list[str]:
return (
cpython_gi_lines_all[:5]
+ cpython_gi_lines_all[82:87]
+ cpython_gi_lines_all[-5:]
)
@pytest.fixture(scope='session')
def cpython_gi_lines_25(cpython_gi_lines_all: list[str]) -> list[str]:
return (
cpython_gi_lines_all[:10]
+ cpython_gi_lines_all[82:87]
+ cpython_gi_lines_all[-10:]
)
@pytest.fixture(scope='session')
def cpython_gi_lines_50(cpython_gi_lines_all: list[str]) -> list[str]:
return (
cpython_gi_lines_all[:20]
+ cpython_gi_lines_all[80:90]
+ cpython_gi_lines_all[-20:]
)
@pytest.fixture(scope='session')
def cpython_gi_lines_100(cpython_gi_lines_all: list[str]) -> list[str]:
return (
cpython_gi_lines_all[:40]
+ cpython_gi_lines_all[80:100]
+ cpython_gi_lines_all[-40:]
)
@pytest.fixture(scope='session')
def cpython_file_match_end() -> str:
"""
File matching pattern near the end of cpython ".gitignore".
"""
return "CLAUDE.local.md"
@pytest.fixture(scope='session')
def cpython_file_match_middle() -> str:
"""
File matching pattern near the middle of cpython ".gitignore".
"""
return "Modules/config.c"
@pytest.fixture(scope='session')
def cpython_file_match_none() -> str:
"""
File not matching any pattern in cpython ".gitignore".
"""
return "Unladen Swallow"
@pytest.fixture(scope='session')
def cpython_file_match_start() -> str:
"""
File matching pattern near the beginning of cpython ".gitignore".
"""
return "spam.cover"
@pytest.fixture(scope='session')
def flit_dir() -> Path:
return Path("~/Downloads/flit").expanduser()
@pytest.fixture(scope='session')
def flit_files(flit_dir: Path) -> set[str]:
return set(iter_tree_files(flit_dir))
@pytest.fixture(scope='session')
def flit_gi_file(flit_dir: Path) -> Path:
return flit_dir / ".gitignore"
@pytest.fixture(scope='session')
def flit_gi_lines_all(flit_gi_file: Path) -> list[str]:
return flit_gi_file.read_text().splitlines()
@pytest.fixture(scope='session')
def flit_gi_lines_1() -> list[str]:
return [
"/dist/",
]
@pytest.fixture(scope='session')
def flit_gi_lines_2() -> list[str]:
return [
"/dist/",
"*.pyc",
]
@pytest.fixture(scope='session')
def flit_gi_lines_5() -> list[str]:
return [
"/dist/",
"__pycache__/",
"/htmlcov/",
"*.pyc",
".python-version",
]
@pytest.fixture(scope='session')
def flit_file_match_end() -> str:
"""
File matching pattern near the end of flit ".gitignore".
"""
return "green.pyc"
@pytest.fixture(scope='session')
def flit_file_match_middle() -> str:
"""
File matching pattern near the middle of flit ".gitignore".
"""
return "htmlcov/eggs"
@pytest.fixture(scope='session')
def flit_file_match_none() -> str:
"""
File not matching any pattern in flit ".gitignore".
"""
return "Unladen Swallow"
@pytest.fixture(scope='session')
def flit_file_match_start() -> str:
"""
File matching pattern near the beginning of flit ".gitignore".
"""
return "dist/ham"
|