|
1 |
| -from sp_repo_review._compat import tomllib |
2 |
| -from sp_repo_review.checks import pyproject |
| 1 | +from repo_review.testing import compute_check, toml_loads |
3 | 2 |
|
4 | 3 |
|
5 | 4 | def test_PP002_okay():
|
6 |
| - toml = tomllib.loads(""" |
| 5 | + toml = toml_loads(""" |
7 | 6 | [build-system]
|
8 | 7 | requires = ["setuptools"]
|
9 | 8 | build-backend = "setuptools.build_meta"
|
10 | 9 | """)
|
11 |
| - assert pyproject.PP002.check(toml) |
| 10 | + assert compute_check("PP002", pyproject=toml).result |
12 | 11 |
|
13 | 12 |
|
14 | 13 | def test_PP002_not_list():
|
15 |
| - toml = tomllib.loads(""" |
| 14 | + toml = toml_loads(""" |
16 | 15 | [build-system]
|
17 | 16 | requires = "setuptools"
|
18 | 17 | build-backend = "setuptools.build_meta"
|
19 | 18 | """)
|
20 |
| - assert not pyproject.PP002.check(toml) |
| 19 | + assert not compute_check("PP002", pyproject=toml).result |
21 | 20 |
|
22 | 21 |
|
23 | 22 | def test_PP002_missing():
|
24 |
| - toml = tomllib.loads(""" |
| 23 | + toml = toml_loads(""" |
25 | 24 | [project]
|
26 | 25 | name = "hi"
|
27 | 26 | version = "1.0.0"
|
28 | 27 | """)
|
29 |
| - assert not pyproject.PP002.check(toml) |
| 28 | + assert not compute_check("PP002", pyproject=toml).result |
30 | 29 |
|
31 | 30 |
|
32 | 31 | def test_PP003_no_wheel():
|
33 |
| - toml = tomllib.loads(""" |
| 32 | + toml = toml_loads(""" |
34 | 33 | [build-system]
|
35 | 34 | requires = ["setuptools"]
|
36 | 35 | build-backend = "setuptools.build_meta"
|
37 | 36 | """)
|
38 |
| - assert pyproject.PP003.check(toml) |
| 37 | + assert compute_check("PP003", pyproject=toml).result |
39 | 38 |
|
40 | 39 |
|
41 | 40 | def test_PP003_has_wheel():
|
42 |
| - toml = tomllib.loads(""" |
| 41 | + toml = toml_loads(""" |
43 | 42 | [build-system]
|
44 | 43 | requires = ["setuptools", "wheel"]
|
45 | 44 | build-backend = "setuptools.build_meta"
|
46 | 45 | """)
|
47 |
| - assert not pyproject.PP003.check(toml) |
| 46 | + assert not compute_check("PP003", pyproject=toml).result |
48 | 47 |
|
49 | 48 |
|
50 | 49 | def test_PP302_okay_intstr():
|
51 |
| - toml = tomllib.loads(""" |
| 50 | + toml = toml_loads(""" |
52 | 51 | [tool.pytest.ini_options]
|
53 | 52 | minversion = "7"
|
54 | 53 | """)
|
55 |
| - assert pyproject.PP302.check(toml) |
| 54 | + assert compute_check("PP302", pyproject=toml).result |
56 | 55 |
|
57 | 56 |
|
58 | 57 | def test_PP302_okay_verstr():
|
59 |
| - toml = tomllib.loads(""" |
| 58 | + toml = toml_loads(""" |
60 | 59 | [tool.pytest.ini_options]
|
61 | 60 | minversion = "7.0.2"
|
62 | 61 | """)
|
63 |
| - assert pyproject.PP302.check(toml) |
| 62 | + assert compute_check("PP302", pyproject=toml).result |
64 | 63 |
|
65 | 64 |
|
66 | 65 | def test_PP302_okay_rawint():
|
67 |
| - toml = tomllib.loads(""" |
| 66 | + toml = toml_loads(""" |
68 | 67 | [tool.pytest.ini_options]
|
69 | 68 | minversion = 7
|
70 | 69 | """)
|
71 |
| - assert pyproject.PP302.check(toml) |
| 70 | + assert compute_check("PP302", pyproject=toml).result |
72 | 71 |
|
73 | 72 |
|
74 | 73 | def test_PP302_okay_rawfloat():
|
75 |
| - toml = tomllib.loads(""" |
| 74 | + toml = toml_loads(""" |
76 | 75 | [tool.pytest.ini_options]
|
77 | 76 | minversion = 7.0
|
78 | 77 | """)
|
79 |
| - assert pyproject.PP302.check(toml) |
| 78 | + assert compute_check("PP302", pyproject=toml).result |
80 | 79 |
|
81 | 80 |
|
82 | 81 | def test_PP302_missing():
|
83 |
| - toml = tomllib.loads(""" |
| 82 | + toml = toml_loads(""" |
84 | 83 | [tool.pytest]
|
85 | 84 | ini_options = {}
|
86 | 85 | """)
|
87 |
| - assert not pyproject.PP302.check(toml) |
| 86 | + assert not compute_check("PP302", pyproject=toml).result |
88 | 87 |
|
89 | 88 |
|
90 | 89 | def test_PP302_too_low():
|
91 |
| - toml = tomllib.loads(""" |
| 90 | + toml = toml_loads(""" |
92 | 91 | [tool.pytest.ini_options]
|
93 | 92 | minversion = "5"
|
94 | 93 | """)
|
95 |
| - assert not pyproject.PP302.check(toml) |
| 94 | + assert not compute_check("PP302", pyproject=toml).result |
0 commit comments