|
14 | 14 |
|
15 | 15 | import mesonpy |
16 | 16 |
|
17 | | -from .conftest import in_git_repo_context |
| 17 | +from .conftest import in_git_repo_context, metadata |
18 | 18 |
|
19 | 19 |
|
20 | 20 | def test_no_pep621(sdist_library): |
21 | 21 | with tarfile.open(sdist_library, 'r:gz') as sdist: |
22 | | - sdist_pkg_info = sdist.extractfile('library-1.0.0/PKG-INFO').read().decode() |
| 22 | + sdist_pkg_info = sdist.extractfile('library-1.0.0/PKG-INFO').read() |
23 | 23 |
|
24 | | - assert sdist_pkg_info == textwrap.dedent('''\ |
| 24 | + assert metadata(sdist_pkg_info) == metadata(textwrap.dedent('''\ |
25 | 25 | Metadata-Version: 2.1 |
26 | 26 | Name: library |
27 | 27 | Version: 1.0.0 |
28 | | - ''') |
| 28 | + ''')) |
29 | 29 |
|
30 | 30 |
|
31 | 31 | def test_pep621(sdist_full_metadata): |
32 | 32 | with tarfile.open(sdist_full_metadata, 'r:gz') as sdist: |
33 | | - sdist_pkg_info = sdist.extractfile('full_metadata-1.2.3/PKG-INFO').read().decode() |
| 33 | + sdist_pkg_info = sdist.extractfile('full_metadata-1.2.3/PKG-INFO').read() |
34 | 34 |
|
35 | | - metadata = textwrap.dedent('''\ |
| 35 | + meta = metadata(sdist_pkg_info) |
| 36 | + |
| 37 | + # pyproject-metadata prior to 0.9.0 strips trailing newlines |
| 38 | + meta['license'] = meta['license'].rstrip() |
| 39 | + |
| 40 | + assert meta == metadata(textwrap.dedent('''\ |
36 | 41 | Metadata-Version: 2.1 |
37 | 42 | Name: full-metadata |
38 | 43 | Version: 1.2.3 |
@@ -67,20 +72,18 @@ def test_pep621(sdist_full_metadata): |
67 | 72 | # full-metadata |
68 | 73 |
|
69 | 74 | An example package with all of the PEP 621 metadata! |
70 | | - ''') |
71 | | - |
72 | | - assert sdist_pkg_info == metadata |
| 75 | + ''')) |
73 | 76 |
|
74 | 77 |
|
75 | 78 | def test_dynamic_version(sdist_dynamic_version): |
76 | 79 | with tarfile.open(sdist_dynamic_version, 'r:gz') as sdist: |
77 | | - sdist_pkg_info = sdist.extractfile('dynamic_version-1.0.0/PKG-INFO').read().decode() |
| 80 | + sdist_pkg_info = sdist.extractfile('dynamic_version-1.0.0/PKG-INFO').read() |
78 | 81 |
|
79 | | - assert sdist_pkg_info == textwrap.dedent('''\ |
| 82 | + assert metadata(sdist_pkg_info) == metadata(textwrap.dedent('''\ |
80 | 83 | Metadata-Version: 2.1 |
81 | 84 | Name: dynamic-version |
82 | 85 | Version: 1.0.0 |
83 | | - ''') |
| 86 | + ''')) |
84 | 87 |
|
85 | 88 |
|
86 | 89 | def test_contents(sdist_library): |
|
0 commit comments