diff options
| author | Alex Grönholm <alex.gronholm@nextday.fi> | 2021-12-22 16:30:41 +0200 |
|---|---|---|
| committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2021-12-22 16:30:41 +0200 |
| commit | fa4de8bd7dce1611be217ade3aade0bd8c76ca7a (patch) | |
| tree | 621e55e88d3861bea1dc2c42ea0eae87b5930b89 /tests | |
| parent | 45af6b0f420b7a90af417b3846b0bdfe1c6a70d4 (diff) | |
| download | wheel-git-fa4de8bd7dce1611be217ade3aade0bd8c76ca7a.tar.gz | |
Upgraded to py3.7+ syntax
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conftest.py | 7 | ||||
| -rw-r--r-- | tests/test_bdist_wheel.py | 4 | ||||
| -rw-r--r-- | tests/test_tagopt.py | 4 | ||||
| -rw-r--r-- | tests/test_wheelfile.py | 12 | ||||
| -rw-r--r-- | tests/testdata/abi3extension.dist/setup.py | 2 | ||||
| -rw-r--r-- | tests/testdata/complex-dist/setup.py | 4 | ||||
| -rw-r--r-- | tests/testdata/extension.dist/setup.py | 2 | ||||
| -rw-r--r-- | tests/testdata/headers.dist/setup.py | 2 | ||||
| -rw-r--r-- | tests/testdata/simple.dist/setup.py | 2 | ||||
| -rw-r--r-- | tests/testdata/unicode.dist/setup.py | 2 |
10 files changed, 19 insertions, 22 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index d9821b8..153954c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,11 +12,8 @@ import pytest @pytest.fixture(scope='session') def wheels_and_eggs(tmpdir_factory): """Build wheels and eggs from test distributions.""" - test_distributions = "complex-dist", "simple.dist", "headers.dist", "commasinfilenames.dist" - if sys.version_info >= (3, 6): - # Only Python 3.6+ can handle packaging unicode file names reliably - # across different platforms - test_distributions += ("unicode.dist",) + test_distributions = ("complex-dist", "simple.dist", "headers.dist", "commasinfilenames.dist", + "unicode.dist") if sys.platform != 'win32': # ABI3 extensions don't really work on Windows diff --git a/tests/test_bdist_wheel.py b/tests/test_bdist_wheel.py index a0de591..6c47c47 100644 --- a/tests/test_bdist_wheel.py +++ b/tests/test_bdist_wheel.py @@ -57,7 +57,7 @@ def test_unicode_record(wheel_paths): with ZipFile(path) as zf: record = zf.read('unicode.dist-0.1.dist-info/RECORD') - assert u'åäö_日本語.py'.encode('utf-8') in record + assert 'åäö_日本語.py'.encode() in record def test_licenses_default(dummy_dist, monkeypatch, tmpdir): @@ -138,7 +138,7 @@ def test_build_from_readonly_tree(dummy_dist, monkeypatch, tmpdir): def test_compression(dummy_dist, monkeypatch, tmpdir, option, compress_type): monkeypatch.chdir(dummy_dist) subprocess.check_call([sys.executable, 'setup.py', 'bdist_wheel', '-b', str(tmpdir), - '--universal', '--compression={}'.format(option)]) + '--universal', f'--compression={option}']) with WheelFile('dist/dummy_dist-1.0-py2.py3-none-any.whl') as wf: filenames = set(wf.namelist()) assert 'dummy_dist-1.0.dist-info/RECORD' in filenames diff --git a/tests/test_tagopt.py b/tests/test_tagopt.py index d40b078..dd0c7a2 100644 --- a/tests/test_tagopt.py +++ b/tests/test_tagopt.py @@ -56,7 +56,7 @@ def test_default_tag(temp_pkg): assert dist_dir.check(dir=1) wheels = dist_dir.listdir() assert len(wheels) == 1 - assert wheels[0].basename == 'Test-1.0-py%s-none-any.whl' % (sys.version_info[0],) + assert wheels[0].basename == f'Test-1.0-py{sys.version_info[0]}-none-any.whl' assert wheels[0].ext == '.whl' @@ -67,7 +67,7 @@ def test_build_number(temp_pkg): assert dist_dir.check(dir=1) wheels = dist_dir.listdir() assert len(wheels) == 1 - assert (wheels[0].basename == 'Test-1.0-1-py%s-none-any.whl' % (sys.version_info[0],)) + assert (wheels[0].basename == f'Test-1.0-1-py{sys.version_info[0]}-none-any.whl') assert wheels[0].ext == '.whl' diff --git a/tests/test_wheelfile.py b/tests/test_wheelfile.py index 0e060b1..f6e6125 100644 --- a/tests/test_wheelfile.py +++ b/tests/test_wheelfile.py @@ -29,7 +29,7 @@ def test_wheelfile_re(tmpdir): ]) def test_bad_wheel_filename(filename): exc = pytest.raises(WheelError, WheelFile, filename) - exc.match('^Bad wheel filename {!r}$'.format(filename)) + exc.match(f'^Bad wheel filename {filename!r}$') def test_missing_record(wheel_path): @@ -56,14 +56,14 @@ def test_unsupported_hash_algorithm(wheel_path): ('sha1', 'QjCnGu5Qucb6-vir1a6BVptvOA4') ], ids=['md5', 'sha1']) def test_weak_hash_algorithm(wheel_path, algorithm, digest): - hash_string = '{}={}'.format(algorithm, digest) + hash_string = f'{algorithm}={digest}' with ZipFile(wheel_path, 'w') as zf: zf.writestr(native('hello/héllö.py'), as_bytes('print("Héllö, w0rld!")\n')) zf.writestr('test-1.0.dist-info/RECORD', - as_bytes('hello/héllö.py,{},25'.format(hash_string))) + as_bytes(f'hello/héllö.py,{hash_string},25')) exc = pytest.raises(WheelError, WheelFile, wheel_path) - exc.match(r"^Weak hash algorithm \({}\) is not permitted by PEP 427$".format(algorithm)) + exc.match(fr"^Weak hash algorithm \({algorithm}\) is not permitted by PEP 427$") @pytest.mark.parametrize('algorithm, digest', [ @@ -73,11 +73,11 @@ def test_weak_hash_algorithm(wheel_path, algorithm, digest): 'iLNpWVxTwuDWqBQ') ], ids=['sha256', 'sha384', 'sha512']) def test_testzip(wheel_path, algorithm, digest): - hash_string = '{}={}'.format(algorithm, digest) + hash_string = f'{algorithm}={digest}' with ZipFile(wheel_path, 'w') as zf: zf.writestr(native('hello/héllö.py'), as_bytes('print("Héllö, world!")\n')) zf.writestr('test-1.0.dist-info/RECORD', - as_bytes('hello/héllö.py,{},25'.format(hash_string))) + as_bytes(f'hello/héllö.py,{hash_string},25')) with WheelFile(wheel_path) as wf: wf.testzip() diff --git a/tests/testdata/abi3extension.dist/setup.py b/tests/testdata/abi3extension.dist/setup.py index 3ffd839..e9a08df 100644 --- a/tests/testdata/abi3extension.dist/setup.py +++ b/tests/testdata/abi3extension.dist/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, Extension setup(name='extension.dist', version='0.1', - description=u'A testing distribution \N{SNOWMAN}', + description='A testing distribution \N{SNOWMAN}', ext_modules=[ Extension(name='extension', sources=['extension.c'], diff --git a/tests/testdata/complex-dist/setup.py b/tests/testdata/complex-dist/setup.py index 41cfb04..632ae3f 100644 --- a/tests/testdata/complex-dist/setup.py +++ b/tests/testdata/complex-dist/setup.py @@ -2,8 +2,8 @@ from setuptools import setup setup(name='complex-dist', version='0.1', - description=u'Another testing distribution \N{SNOWMAN}', - long_description=u'Another testing distribution \N{SNOWMAN}', + description='Another testing distribution \N{SNOWMAN}', + long_description='Another testing distribution \N{SNOWMAN}', author="Illustrious Author", author_email="illustrious@example.org", url="http://example.org/exemplary", diff --git a/tests/testdata/extension.dist/setup.py b/tests/testdata/extension.dist/setup.py index ae22525..c9bf948 100644 --- a/tests/testdata/extension.dist/setup.py +++ b/tests/testdata/extension.dist/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, Extension setup(name='extension.dist', version='0.1', - description=u'A testing distribution \N{SNOWMAN}', + description='A testing distribution \N{SNOWMAN}', ext_modules=[ Extension(name='extension', sources=['extension.c']) diff --git a/tests/testdata/headers.dist/setup.py b/tests/testdata/headers.dist/setup.py index 67cada3..2c7d7ea 100644 --- a/tests/testdata/headers.dist/setup.py +++ b/tests/testdata/headers.dist/setup.py @@ -2,6 +2,6 @@ from setuptools import setup setup(name='headers.dist', version='0.1', - description=u'A distribution with headers', + description='A distribution with headers', headers=['header.h'] ) diff --git a/tests/testdata/simple.dist/setup.py b/tests/testdata/simple.dist/setup.py index d2aaac9..81b26cd 100644 --- a/tests/testdata/simple.dist/setup.py +++ b/tests/testdata/simple.dist/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup(name='simple.dist', version='0.1', - description=u'A testing distribution \N{SNOWMAN}', + description='A testing distribution \N{SNOWMAN}', packages=['simpledist'], extras_require={'voting': ['beaglevote']}, ) diff --git a/tests/testdata/unicode.dist/setup.py b/tests/testdata/unicode.dist/setup.py index 3382b53..221088e 100644 --- a/tests/testdata/unicode.dist/setup.py +++ b/tests/testdata/unicode.dist/setup.py @@ -2,6 +2,6 @@ from setuptools import setup setup(name='unicode.dist', version='0.1', - description=u'A testing distribution \N{SNOWMAN}', + description='A testing distribution \N{SNOWMAN}', packages=['unicodedist'] ) |
