Skip to content

Commit 2b2bee5

Browse files
committed
minor fix
1 parent a135cc4 commit 2b2bee5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

codeflash/code_utils/code_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def custom_addopts() -> None:
3232
original_addopts = data.get("tool", {}).get("pytest", {}).get("ini_options", {}).get("addopts", "")
3333
# nothing to do if no addopts present
3434
if original_addopts != "":
35+
original_addopts = [x.strip() for x in original_addopts]
3536
non_blacklist_plugin_args = re.sub(r"-n(?: +|=)\S+", "", " ".join(original_addopts)).split(" ")
37+
non_blacklist_plugin_args = [x for x in non_blacklist_plugin_args if x!=""]
3638
if non_blacklist_plugin_args != original_addopts:
3739
data["tool"]["pytest"]["ini_options"]["addopts"] = non_blacklist_plugin_args
3840
# Write modified file
@@ -73,15 +75,15 @@ def add_addopts_to_pyproject() -> None:
7375
"-n auto",
7476
]
7577
with Path.open(
76-
(Path(__file__).parent.parent.parent / "pyproject.toml").resolve(), "w", encoding="utf-8"
78+
pyproject_file, "w", encoding="utf-8"
7779
) as f:
7880
f.write(tomlkit.dumps(data))
7981

8082
yield
8183

8284
finally:
8385
# Restore original file
84-
with Path.open(Path("pyproject.toml"), "w", encoding="utf-8") as f:
86+
with Path.open(pyproject_file, "w", encoding="utf-8") as f:
8587
f.write(original_content)
8688

8789

0 commit comments

Comments
 (0)