Closed hroncok closed 8 months ago
Thank you!
This issue unfortunately now shows up if you invoke pytest with verbose and it will have this error even if it succeeds.
diff --git a/test/test_main.py b/test/test_main.py
index 2a86c13..adaeddf 100644
--- a/test/test_main.py
+++ b/test/test_main.py
@@ -256,10 +256,8 @@ def test_conditional_pager(monkeypatch):
def test_reserved_space_is_integer(monkeypatch):
"""Make sure that reserved space is returned as an integer."""
- def stub_terminal_size():
- return (5, 5)
-
- monkeypatch.setattr(shutil, 'get_terminal_size', stub_terminal_size)
+ monkeypatch.setenv("COLUMNS", "5")
+ monkeypatch.setenv("LINES", "5")
mycli = MyCli()
assert isinstance(mycli.get_reserved_space(), int)
Modifying env instead wouldn't such issues at least.
The original way led to very confusing internal pytest errors when the test failed.
When the test failed, the original function was not restored, and pytest uses it:
Description
Checklist
changelog.md
.AUTHORS
file (or it's already there).