Skip to content

Commit

Permalink
Remove redundant code for Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored and ionelmc committed Mar 18, 2024
1 parent 1a4b2c5 commit 6aefc1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ci/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def main():
# This uses sys.executable the same way that the call in
# cookiecutter-pylibrary/hooks/post_gen_project.py
# invokes this bootstrap.py itself.
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines()
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], text=True).splitlines()
]
tox_environments = [line for line in tox_environments if line.startswith('py')]
for template in templates_path.rglob('*'):
Expand Down
12 changes: 4 additions & 8 deletions tests/test_pytest_cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@

import pytest_cov.plugin

try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from io import StringIO

coverage, platform # required for skipif mark on test_cov_min_from_coveragerc

Expand Down Expand Up @@ -1240,8 +1237,7 @@ def test_run():
stdout, stderr = proc.communicate()
assert not stderr
assert stdout == b""
# it appears signal handling is buggy on python 2?
if sys.version_info == 3: assert proc.returncode in [128 + signal.SIGTERM, -signal.SIGTERM]
assert proc.returncode in [128 + signal.SIGTERM, -signal.SIGTERM]
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_IGN)
Expand All @@ -1258,7 +1254,7 @@ def test_run():

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

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


Expand Down Expand Up @@ -1480,7 +1476,7 @@ def test_dist_boxed(testdir):


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

Expand Down

0 comments on commit 6aefc1d

Please sign in to comment.