Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging error with emoji in git branch name. #2790

Merged
merged 4 commits into from Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/2768.bugfix.rst
@@ -0,0 +1 @@
Fix logging error with emoji in git branch name.
2 changes: 1 addition & 1 deletion src/tox/pytest.py
Expand Up @@ -161,7 +161,7 @@ def _setup_files(dest: Path, base: Path | None, content: dict[str, Any]) -> None
at_path.mkdir(exist_ok=True)
ToxProject._setup_files(at_path, None, value)
elif isinstance(value, str):
at_path.write_text(textwrap.dedent(value))
at_path.write_text(textwrap.dedent(value), encoding="utf-8")
elif value is None:
at_path.mkdir()
else:
Expand Down
2 changes: 1 addition & 1 deletion src/tox/tox_env/api.py
Expand Up @@ -444,7 +444,7 @@ def _log_execute(self, request: ExecuteRequest, status: ExecuteStatus) -> None:

@staticmethod
def _write_execute_log(env_name: str, log_file: Path, request: ExecuteRequest, status: ExecuteStatus) -> None:
with log_file.open("wt") as file:
with log_file.open("wt", encoding="utf-8") as file:
file.write(f"name: {env_name}\n")
file.write(f"run_id: {request.run_id}\n")
for env_key, env_value in request.env.items():
Expand Down
3 changes: 2 additions & 1 deletion tests/tox_env/test_tox_env_api.py
Expand Up @@ -34,7 +34,8 @@ def test_allow_list_external_fail(tox_project: ToxProjectCreator, fake_exe_on_pa

def test_env_log(tox_project: ToxProjectCreator) -> None:
cmd = "commands=python -c 'import sys; print(1); print(2); print(3, file=sys.stderr); print(4, file=sys.stderr)'"
prj = tox_project({"tox.ini": f"[testenv]\npackage=skip\n{cmd}"})
env_vars = " UNPREDICTABLE = 🪟"
prj = tox_project({"tox.ini": f"[testenv]\npackage=skip\nset_env =\n{env_vars}\n{cmd}"})
result_first = prj.run("r")
result_first.assert_success()

Expand Down