Skip to content

Commit 6aefc1d

Browse files
hugovkionelmc
authored andcommitted
Remove redundant code for Python 2
1 parent 1a4b2c5 commit 6aefc1d

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

ci/bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def main():
5959
# This uses sys.executable the same way that the call in
6060
# cookiecutter-pylibrary/hooks/post_gen_project.py
6161
# invokes this bootstrap.py itself.
62-
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines()
62+
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], text=True).splitlines()
6363
]
6464
tox_environments = [line for line in tox_environments if line.startswith('py')]
6565
for template in templates_path.rglob('*'):

tests/test_pytest_cov.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020

2121
import pytest_cov.plugin
2222

23-
try:
24-
from StringIO import StringIO
25-
except ImportError:
26-
from io import StringIO
23+
from io import StringIO
2724

2825
coverage, platform # required for skipif mark on test_cov_min_from_coveragerc
2926

@@ -1240,8 +1237,7 @@ def test_run():
12401237
stdout, stderr = proc.communicate()
12411238
assert not stderr
12421239
assert stdout == b""
1243-
# it appears signal handling is buggy on python 2?
1244-
if sys.version_info == 3: assert proc.returncode in [128 + signal.SIGTERM, -signal.SIGTERM]
1240+
assert proc.returncode in [128 + signal.SIGTERM, -signal.SIGTERM]
12451241
12461242
if __name__ == "__main__":
12471243
signal.signal(signal.SIGINT, signal.SIG_IGN)
@@ -1258,7 +1254,7 @@ def test_run():
12581254

12591255
result = testdir.runpytest('-vv', '--assert=plain', f'--cov={script.dirpath()}', '--cov-report=term-missing', script)
12601256

1261-
result.stdout.fnmatch_lines(['*- coverage: platform *, python * -*', 'test_cleanup_on_sigterm* 89% 23-24', '*1 passed*'])
1257+
result.stdout.fnmatch_lines(['*- coverage: platform *, python * -*', 'test_cleanup_on_sigterm* 89% 22-23', '*1 passed*'])
12621258
assert result.ret == 0
12631259

12641260

@@ -1480,7 +1476,7 @@ def test_dist_boxed(testdir):
14801476

14811477

14821478
@pytest.mark.skipif('sys.platform == "win32"')
1483-
@pytest.mark.skipif('sys.version_info[0] > 2 and platform.python_implementation() == "PyPy"', reason='strange optimization on PyPy3')
1479+
@pytest.mark.skipif('platform.python_implementation() == "PyPy"', reason='strange optimization on PyPy3')
14841480
def test_dist_bare_cov(testdir):
14851481
script = testdir.makepyfile(SCRIPT_SIMPLE)
14861482

0 commit comments

Comments
 (0)