Skip to content

Commit

Permalink
Attempted fix for windows cp1252 encoding failure (#3687)
Browse files Browse the repository at this point in the history
* Attempt to fix windows test

* Revert "Attempt to fix windows test"

This reverts commit e31c207.

* try a different fix

* maybe both fixes together?

* try adding in CI

* Update ci.yml

* Update logger_utils.py

* maybe needs a dash?

* try utf8 again

* Remove legacy_windows

* try changing test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Try decoding after capturing bytes output

* Nicer fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
  • Loading branch information
JasonGrace2282 authored Apr 11, 2024
1 parent 294313d commit 93cf85c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
env:
DISPLAY: :0
PYTEST_ADDOPTS: "--color=yes" # colors in pytest
PYTHONIOENCODING: "utf8"
strategy:
fail-fast: false
matrix:
Expand Down
9 changes: 8 additions & 1 deletion manim/utils/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@


def capture(command, cwd=None, command_input=None):
p = run(command, cwd=cwd, input=command_input, capture_output=True, text=True)
p = run(
command,
cwd=cwd,
input=command_input,
capture_output=True,
text=True,
encoding="utf-8",
)
out, err = p.stdout, p.stderr
return out, err, p.returncode

Expand Down
6 changes: 4 additions & 2 deletions tests/test_logging/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ def test_error_logging(tmp_path, python_version):
str(path_error_scene),
]

_, err, exitcode = capture(command)
assert exitcode != 0 and len(err) > 0
out, err, exitcode = capture(command)
if err is None:
err = out
assert exitcode != 0 and "Traceback (most recent call last)" in err


@logs_comparison(
Expand Down

0 comments on commit 93cf85c

Please sign in to comment.