1111PROJECT_ROOT = Path (__file__ ).parent .parent
1212SRC_DIR = PROJECT_ROOT / "src"
1313
14+ # Constants for ignore file names
15+ GITIGNORE = ".gitignore"
16+ TREEMAPPERIGNORE = ".treemapperignore"
17+
1418
1519# --- Фикстура для создания временного проекта ---
1620@pytest .fixture
@@ -26,8 +30,8 @@ def temp_project(tmp_path):
2630 (temp_dir / "output" ).mkdir ()
2731 (temp_dir / ".git" ).mkdir ()
2832 (temp_dir / ".git" / "config" ).write_text ("git config file" , encoding = "utf-8" )
29- (temp_dir / ".gitignore" ).write_text ("*.pyc\n __pycache__/\n " , encoding = "utf-8" )
30- (temp_dir / ".treemapperignore" ).write_text ("output/\n .git/\n " , encoding = "utf-8" )
33+ (temp_dir / GITIGNORE ).write_text ("*.pyc\n __pycache__/\n " , encoding = "utf-8" )
34+ (temp_dir / TREEMAPPERIGNORE ).write_text ("output/\n .git/\n " , encoding = "utf-8" )
3135 yield temp_dir
3236
3337
@@ -181,13 +185,13 @@ def add_dir(self, path: str) -> Path:
181185 return dir_path
182186
183187 def add_gitignore (self , patterns : List [str ], subdir : str = "" ) -> Path :
184- path = self .root / subdir / ".gitignore" if subdir else self .root / ".gitignore"
188+ path = self .root / subdir / GITIGNORE if subdir else self .root / GITIGNORE
185189 path .parent .mkdir (parents = True , exist_ok = True )
186190 path .write_text ("\n " .join (patterns ) + "\n " , encoding = "utf-8" )
187191 return path
188192
189193 def add_treemapperignore (self , patterns : List [str ]) -> Path :
190- path = self .root / ".treemapperignore"
194+ path = self .root / TREEMAPPERIGNORE
191195 path .write_text ("\n " .join (patterns ) + "\n " , encoding = "utf-8" )
192196 return path
193197
0 commit comments