File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ class DTConfig:
9494 a string. If not empty, the string value is used as the skip reason.
9595 pytest_extra_requires : dict
9696 Paths or functions to conditionally ignore unless requirements are met.
97- The format is ``{path/or/glob/pattern: requirement, full.func.name: requiremet }``,
97+ The format is ``{path/or/glob/pattern: requirement(s) , full.func.name: requirement(s) }``,
9898 where the values are PEP 508 dependency specifiers. If a requirement is not met,
9999 the behavior is equivalent to using the ``--ignore=...`` command line switch for
100100 paths, and to using a `pytest_extra_skip` for function names.
Original file line number Diff line number Diff line change @@ -88,9 +88,9 @@ def pytest_ignore_collect(collection_path, config):
8888 if fnmatch_ex (entry , collection_path ):
8989 return True
9090
91- for entry , req_str in config .dt_config .pytest_extra_requires .items ():
91+ for entry , reqs in config .dt_config .pytest_extra_requires .items ():
9292 if fnmatch_ex (entry , collection_path ):
93- return not is_req_satisfied (req_str )
93+ return not is_req_satisfied (reqs )
9494
9595
9696def is_private (item ):
Original file line number Diff line number Diff line change @@ -257,12 +257,16 @@ def get_public_objects(module, skiplist=None):
257257 return (items , names ), failures
258258
259259
260- def is_req_satisfied (req_str ) :
261- """ Check if a PEP 508-compliant requirement is satisfied or not.
260+ def is_req_satisfied (req_strs : str | Sequence [ str ]) -> bool :
261+ """ Check if all PEP 508-compliant requirement(s) are satisfied or not.
262262 """
263- req = Requirement (req_str )
263+ req_strs = [req_strs ] if isinstance (req_strs , str ) else req_strs
264+ reqs = [Requirement (req_str ) for req_str in req_strs ]
265+ if any (req .marker is not None for req in reqs ):
266+ msg = r"Markers not supported in `pytest_extra_requires`"
267+ raise NotImplementedError (msg )
264268 try :
265- return get_version (req .name ) in req .specifier
269+ return all ( get_version (req .name ) in req .specifier for req in reqs )
266270 except PackageNotFoundError :
267271 return False
268272
You can’t perform that action at this time.
0 commit comments