@@ -241,5 +241,67 @@ def check(pyproject: dict[str, Any]) -> bool:
241
241
return "filterwarnings" in options
242
242
243
243
244
+ class PP310 (PyProject ):
245
+ "Tests target is test not test (spec13)"
246
+
247
+ requires = {"PP301" }
248
+ url = mk_url ("pytest" )
249
+
250
+ @staticmethod
251
+ def check (pyproject : dict [str , Any ]) -> bool :
252
+ """
253
+
254
+ Tests target should be `tests` not `test`
255
+
256
+ ```toml
257
+ [project.optional-dependencies]
258
+ tests = [
259
+ 'pytest',
260
+ ...
261
+ ]
262
+ ```
263
+ """
264
+ if "tool" not in pyproject :
265
+ return True
266
+ if "project.optional-dependencies" not in pyproject ["tool" ]:
267
+ return True
268
+ optional_deps = pyproject ["tool" ]["project.optional-dependencies" ]
269
+ if "tests" in optional_deps :
270
+ return True
271
+ return "test" not in optional_deps
272
+
273
+
274
+ class PP311 (PyProject ):
275
+ "Tests target is `docs not` `doc` (spec13)"
276
+
277
+ requires = {"PP301" }
278
+ url = mk_url ("pytest" )
279
+
280
+ @staticmethod
281
+ def check (pyproject : dict [str , Any ]) -> bool :
282
+ """
283
+
284
+ docs target should be `docs` not `doc`
285
+
286
+ ```toml
287
+ [project.optional-dependencies]
288
+ docs = [
289
+ 'sphinx',
290
+ ...
291
+ ]
292
+ ```
293
+ """
294
+ if "tool" not in pyproject :
295
+ return True
296
+ if "project.optional-dependencies" not in pyproject ["tool" ]:
297
+ return True
298
+ optional_deps = pyproject ["tool" ]["project.optional-dependencies" ]
299
+ if "docs" in optional_deps :
300
+ return True
301
+ return "doc" not in optional_deps
302
+
303
+ return True # it's ok to have None
304
+
305
+
244
306
def repo_review_checks () -> dict [str , PyProject ]:
245
307
return {p .__name__ : p () for p in PyProject .__subclasses__ ()}
0 commit comments