|
13 | 13 | import tomlkit |
14 | 14 |
|
15 | 15 | from codeflash.cli_cmds.console import logger |
16 | | -from codeflash.code_utils.config_parser import find_conftest, find_pyproject_toml |
| 16 | +from codeflash.code_utils.config_parser import find_pyproject_toml |
17 | 17 |
|
18 | 18 | ImportErrorPattern = re.compile(r"ModuleNotFoundError.*$", re.MULTILINE) |
19 | 19 |
|
@@ -87,64 +87,6 @@ def add_addopts_to_pyproject() -> None: |
87 | 87 | f.write(original_content) |
88 | 88 |
|
89 | 89 |
|
90 | | -@contextmanager |
91 | | -def add_override_fixtures_to_pyproject() -> None: |
92 | | - pyproject_file = find_pyproject_toml() |
93 | | - try: |
94 | | - # Read original file |
95 | | - if pyproject_file.exists(): |
96 | | - with Path.open(pyproject_file, encoding="utf-8") as f: |
97 | | - original_content = f.read() |
98 | | - data = tomlkit.parse(original_content) |
99 | | - # Backup original markers |
100 | | - original_fixtures = data.get("tool", {}).get("codeflash", {}).get("override-fixtures", []) |
101 | | - original_fixtures.append("please_put_your_fixtures_here") |
102 | | - data["tool"]["pytest"]["override-fixtures"]["markers"] = list(original_fixtures) |
103 | | - with Path.open(pyproject_file, "w", encoding="utf-8") as f: |
104 | | - f.write(tomlkit.dumps(data)) |
105 | | - yield |
106 | | - finally: |
107 | | - with Path.open(pyproject_file, "w", encoding="utf-8") as f: |
108 | | - f.write(original_content) |
109 | | - |
110 | | - |
111 | | -@contextmanager |
112 | | -def add_custom_markers_to_pyproject() -> None: |
113 | | - pyproject_file = find_pyproject_toml() |
114 | | - try: |
115 | | - # Read original file |
116 | | - if pyproject_file.exists(): |
117 | | - with Path.open(pyproject_file, encoding="utf-8") as f: |
118 | | - original_content = f.read() |
119 | | - data = tomlkit.parse(original_content) |
120 | | - # Backup original markers |
121 | | - original_markers = data.get("tool", {}).get("pytest", {}).get("ini_options", {}).get("markers", []) |
122 | | - original_markers.append("codeflash_no_autouse") |
123 | | - data["tool"]["pytest"]["ini_options"]["markers"] = list(original_markers) |
124 | | - with Path.open(pyproject_file, "w", encoding="utf-8") as f: |
125 | | - f.write(tomlkit.dumps(data)) |
126 | | - yield |
127 | | - finally: |
128 | | - with Path.open(pyproject_file, "w", encoding="utf-8") as f: |
129 | | - f.write(original_content) |
130 | | - |
131 | | - |
132 | | -@contextmanager |
133 | | -def rename_conftest(tests_path: Path) -> None: |
134 | | - conftest_file = find_conftest(tests_path) |
135 | | - tmp_conftest_file = None |
136 | | - try: |
137 | | - # Rename original file |
138 | | - if conftest_file: |
139 | | - tmp_conftest_file = Path(str(conftest_file) + ".tmp") |
140 | | - conftest_file.rename(tmp_conftest_file) |
141 | | - yield |
142 | | - finally: |
143 | | - # Restore original file |
144 | | - if conftest_file: |
145 | | - tmp_conftest_file.rename(conftest_file) |
146 | | - |
147 | | - |
148 | 90 | def encoded_tokens_len(s: str) -> int: |
149 | 91 | """Return the approximate length of the encoded tokens. |
150 | 92 |
|
|
0 commit comments