Skip to content

Commit

Permalink
Update pastebin URL from bpaste to bpa.st (pytest-dev#9131)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffra committed Oct 6, 2021
1 parent e077f1c commit e84ba80
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/9131.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the URL used by ``--pastebin`` to use `bpa.st <http://bpa.st>`__.
2 changes: 1 addition & 1 deletion src/_pytest/pastebin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions testing/test_pastebin.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ def test_pastebin_http_error(self, pastebin, mocked_urlopen_fail) -> None:

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()
Expand Down

0 comments on commit e84ba80

Please sign in to comment.