From e84ba803015918f0ae776f47264cee0d80b54a8e Mon Sep 17 00:00:00 2001 From: Jeff Rasley Date: Wed, 6 Oct 2021 04:12:48 -0700 Subject: [PATCH] Update pastebin URL from bpaste to bpa.st (#9131) --- changelog/9131.bugfix.rst | 1 + src/_pytest/pastebin.py | 2 +- testing/test_pastebin.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog/9131.bugfix.rst diff --git a/changelog/9131.bugfix.rst b/changelog/9131.bugfix.rst new file mode 100644 index 000000000..837bb596d --- /dev/null +++ b/changelog/9131.bugfix.rst @@ -0,0 +1 @@ +Fixed the URL used by ``--pastebin`` to use `bpa.st `__. diff --git a/src/_pytest/pastebin.py b/src/_pytest/pastebin.py index b33383504..385b3022c 100644 --- a/src/_pytest/pastebin.py +++ b/src/_pytest/pastebin.py @@ -77,7 +77,7 @@ def create_new_paste(contents: Union[str, bytes]) -> str: from urllib.parse import urlencode params = {"code": contents, "lexer": "text", "expiry": "1week"} - url = "https://bpaste.net" + url = "https://bpa.st" try: response: str = ( urlopen(url, data=urlencode(params).encode("ascii")).read().decode("utf-8") diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py index eaa9e7511..b338519ae 100644 --- a/testing/test_pastebin.py +++ b/testing/test_pastebin.py @@ -161,12 +161,12 @@ class TestPaste: def test_create_new_paste(self, pastebin, mocked_urlopen) -> None: result = pastebin.create_new_paste(b"full-paste-contents") - assert result == "https://bpaste.net/show/3c0c6750bd" + assert result == "https://bpa.st/show/3c0c6750bd" assert len(mocked_urlopen) == 1 url, data = mocked_urlopen[0] assert type(data) is bytes lexer = "text" - assert url == "https://bpaste.net" + assert url == "https://bpa.st" assert "lexer=%s" % lexer in data.decode() assert "code=full-paste-contents" in data.decode() assert "expiry=1week" in data.decode()