mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
tests: Test deprecations separately
Libraries can add new deprecations, or the environment you're running the tests in might have old libraries where the things we test aren't deprecated yet. Move the deprecations test into its own module with its own code, so it can check library versions and skip the test if it won't work.
This commit is contained in:
parent
a42ec3a945
commit
6acf0fe5a0
4 changed files with 128 additions and 10 deletions
|
@ -171,6 +171,24 @@ class LookupOp(InfixExpr):
|
|||
did_you_mean=(self.property_name, self.lhs.type.properties.keys()),
|
||||
)
|
||||
|
||||
@validate("property")
|
||||
def property_deprecated(self):
|
||||
if self.lhs.type is None or not (
|
||||
isinstance(self.lhs.type, gir.Class)
|
||||
or isinstance(self.lhs.type, gir.Interface)
|
||||
):
|
||||
return
|
||||
|
||||
if property := self.lhs.type.properties.get(self.property_name):
|
||||
if property.deprecated:
|
||||
hints = []
|
||||
if property.deprecated_doc:
|
||||
hints.append(property.deprecated_doc)
|
||||
raise DeprecatedWarning(
|
||||
f"{property.signature} is deprecated",
|
||||
hints=hints,
|
||||
)
|
||||
|
||||
|
||||
class CastExpr(InfixExpr):
|
||||
grammar = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue