Skip to content

Commit f2d87dc

Browse files
authored
Merge pull request #5809 from goerz/pastebin
Fix "lexer" being used when uploading to bpaste.net
2 parents 8aba863 + 9144415 commit f2d87dc

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

changelog/5806.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix "lexer" being used when uploading to bpaste.net from ``--pastebin`` to "text".

src/_pytest/pastebin.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ def create_new_paste(contents):
7777
from urllib.request import urlopen
7878
from urllib.parse import urlencode
7979

80-
params = {
81-
"code": contents,
82-
"lexer": "python3" if sys.version_info[0] >= 3 else "python",
83-
"expiry": "1week",
84-
}
80+
params = {"code": contents, "lexer": "text", "expiry": "1week"}
8581
url = "https://bpaste.net"
8682
response = urlopen(url, data=urlencode(params).encode("ascii")).read()
8783
m = re.search(r'href="/raw/(\w+)"', response.decode("utf-8"))

testing/test_pastebin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_create_new_paste(self, pastebin, mocked_urlopen):
126126
assert len(mocked_urlopen) == 1
127127
url, data = mocked_urlopen[0]
128128
assert type(data) is bytes
129-
lexer = "python3" if sys.version_info[0] >= 3 else "python"
129+
lexer = "text"
130130
assert url == "https://bpaste.net"
131131
assert "lexer=%s" % lexer in data.decode()
132132
assert "code=full-paste-contents" in data.decode()

0 commit comments

Comments
 (0)