-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_metadata.py
42 lines (37 loc) · 1.17 KB
/
test_metadata.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# SPDX-License-Identifier: MIT
import re
import textwrap
import pep621
import pytest
import tomli
import trampolim
import trampolim._metadata
@pytest.mark.parametrize(
('data', 'error'),
[
(
textwrap.dedent('''
[tool.trampolim]
top-level-modules = true
'''),
('Field `tool.trampolim.top-level-modules` has an invalid type, expecting a list of strings (got `True`)'),
),
(
textwrap.dedent('''
[tool.trampolim]
module-location = 0
'''),
('Field `tool.trampolim.module-location` has an invalid type, expecting a string (got `0`)'),
),
(
textwrap.dedent('''
[tool.trampolim]
source-include = 0
'''),
('Field `tool.trampolim.source-include` has an invalid type, expecting a list of strings (got `0`)'),
),
],
)
def test_trampolim_metadata(package_full_metadata, data, error):
with pytest.raises(pep621.ConfigurationError, match=re.escape(error)):
trampolim._metadata.TrampolimMetadata.from_pyproject(tomli.loads(data))