From 4f724608036077beccbd83f8d6a03d40625444c2 Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Thu, 25 Dec 2025 20:38:57 +0000 Subject: [PATCH] fix(pastebin): send paste as text --- src/_pytest/pastebin.py | 6 +----- testing/test_pastebin.py | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/_pytest/pastebin.py b/src/_pytest/pastebin.py index 41576a615b0..7a3e80231c2 100644 --- a/src/_pytest/pastebin.py +++ b/src/_pytest/pastebin.py @@ -77,11 +77,7 @@ def create_new_paste(contents): from urllib.request import urlopen from urllib.parse import urlencode - params = { - "code": contents, - "lexer": "python3" if sys.version_info[0] >= 3 else "python", - "expiry": "1week", - } + params = {"code": contents, "lexer": "text", "expiry": "1week"} url = "https://bpaste.net" response = urlopen(url, data=urlencode(params).encode("ascii")).read() m = re.search(r'href="/raw/(\w+)"', response.decode("utf-8")) diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py index bac8f980240..aac0b651e59 100644 --- a/testing/test_pastebin.py +++ b/testing/test_pastebin.py @@ -126,8 +126,7 @@ def test_create_new_paste(self, pastebin, mocked_urlopen): assert len(mocked_urlopen) == 1 url, data = mocked_urlopen[0] assert type(data) is bytes - lexer = "python3" if sys.version_info[0] >= 3 else "python" assert url == "https://bpaste.net" - assert "lexer=%s" % lexer in data.decode() + assert "lexer=text" in data.decode() assert "code=full-paste-contents" in data.decode() assert "expiry=1week" in data.decode()