From 43f610abf429ac482c01dc85b955f34f3507eab6 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 28 Apr 2023 23:04:22 +0300 Subject: [PATCH] _py/path: tiny change to `ensure` to silence EncodingWarning We're not supposed to diverge here, but make this change to fix an unavoidable EncodingWarning that is otherwise raised in pytest's test suite. The behavior should be exactly the same besides the warning, hopefully that won't cause confusion. --- src/_pytest/_py/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/_py/path.py b/src/_pytest/_py/path.py index fb64830f8..73a070d19 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -953,7 +953,7 @@ class LocalPath: else: p.dirpath()._ensuredirs() if not p.check(file=1): - p.open("w").close() + p.open("wb").close() return p @overload