[4.6] fixes for python4
This commit is contained in:
parent
117f52dcf3
commit
aa79b1c00c
|
@ -0,0 +1 @@
|
|||
Fixes python version checks (detected by ``flake8-2020``) in case python4 becomes a thing.
|
|
@ -79,7 +79,7 @@ def create_new_paste(contents):
|
|||
|
||||
params = {
|
||||
"code": contents,
|
||||
"lexer": "python3" if sys.version_info[0] == 3 else "python",
|
||||
"lexer": "python3" if sys.version_info[0] >= 3 else "python",
|
||||
"expiry": "1week",
|
||||
}
|
||||
url = "https://bpaste.net"
|
||||
|
|
|
@ -1124,7 +1124,7 @@ class Testdir(object):
|
|||
|
||||
if timeout is None:
|
||||
ret = popen.wait()
|
||||
elif six.PY3:
|
||||
elif not six.PY2:
|
||||
try:
|
||||
ret = popen.wait(timeout)
|
||||
except subprocess.TimeoutExpired:
|
||||
|
|
|
@ -223,7 +223,7 @@ class TestGeneralUsage(object):
|
|||
"conftest.py:2: in foo",
|
||||
" import qwerty",
|
||||
"E {}: No module named {q}qwerty{q}".format(
|
||||
exc_name, q="'" if six.PY3 else ""
|
||||
exc_name, q="" if six.PY2 else "'"
|
||||
),
|
||||
]
|
||||
)
|
||||
|
|
|
@ -289,7 +289,7 @@ class TestUnicodeHandling:
|
|||
|
||||
success = dummy_context_manager
|
||||
py2_only = pytest.mark.skipif(
|
||||
six.PY3, reason="bytes in raises only supported in Python 2"
|
||||
not six.PY2, reason="bytes in raises only supported in Python 2"
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -209,7 +209,7 @@ class TestEnvironWarnings(object):
|
|||
|
||||
VAR_NAME = u"PYTEST_INTERNAL_MY_VAR"
|
||||
|
||||
@pytest.mark.skipif(six.PY3, reason="Python 2 only test")
|
||||
@pytest.mark.skipif(not six.PY2, reason="Python 2 only test")
|
||||
def test_setenv_unicode_key(self, monkeypatch):
|
||||
with pytest.warns(
|
||||
pytest.PytestWarning,
|
||||
|
@ -217,7 +217,7 @@ class TestEnvironWarnings(object):
|
|||
):
|
||||
monkeypatch.setenv(self.VAR_NAME, "2")
|
||||
|
||||
@pytest.mark.skipif(six.PY3, reason="Python 2 only test")
|
||||
@pytest.mark.skipif(not six.PY2, reason="Python 2 only test")
|
||||
def test_delenv_unicode_key(self, monkeypatch):
|
||||
with pytest.warns(
|
||||
pytest.PytestWarning,
|
||||
|
|
|
@ -74,7 +74,7 @@ class TestPasteCapture(object):
|
|||
"""
|
||||
)
|
||||
result = testdir.runpytest("--pastebin=all")
|
||||
if sys.version_info[0] == 3:
|
||||
if sys.version_info[0] >= 3:
|
||||
expected_msg = "*assert '☺' == 1*"
|
||||
else:
|
||||
expected_msg = "*assert '\\xe2\\x98\\xba' == 1*"
|
||||
|
@ -126,7 +126,7 @@ class TestPaste(object):
|
|||
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"
|
||||
lexer = "python3" if sys.version_info[0] >= 3 else "python"
|
||||
assert url == "https://bpaste.net"
|
||||
assert "lexer=%s" % lexer in data.decode()
|
||||
assert "code=full-paste-contents" in data.decode()
|
||||
|
|
|
@ -569,7 +569,7 @@ class TestDeprecationWarningsByDefault:
|
|||
assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
|
||||
|
||||
|
||||
@pytest.mark.skipif(six.PY3, reason="Python 2 only issue")
|
||||
@pytest.mark.skipif(not six.PY2, reason="Python 2 only issue")
|
||||
def test_infinite_loop_warning_against_unicode_usage_py2(testdir):
|
||||
"""
|
||||
We need to be careful when raising the warning about unicode usage with "warnings.warn"
|
||||
|
|
Loading…
Reference in New Issue