From 65aee1e0c877def80e32b95be60f0edcb2cb7d5c Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 14 Jul 2019 18:27:09 +0300 Subject: [PATCH] Allow bytes for OutcomeException(msg=...) It's __repr__ explicitly handles it so allow it. --- src/_pytest/outcomes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index aaf0b35fb..df37312ba 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -5,6 +5,7 @@ as well as functions creating them import sys from typing import Any from typing import Optional +from typing import Union from packaging.version import Version @@ -17,7 +18,9 @@ class OutcomeException(BaseException): contain info about test and collection outcomes. """ - def __init__(self, msg: Optional[str] = None, pytrace: bool = True) -> None: + def __init__( + self, msg: Optional[Union[str, bytes]] = None, pytrace: bool = True + ) -> None: BaseException.__init__(self, msg) self.msg = msg self.pytrace = pytrace