Skip to content

Dynamically switching the deprecation warning instance to be raised (i.e. SevereDeprecationWarning) #655

@zhukovgreen

Description

@zhukovgreen

btw I got an idea, what might compliment our deprecation feature. If the period of the deprecation is close to expire, we might dynamically switch the deprecation warning instance to be raise (i.e. SevereDeprecationWarning) and set in pytest.ini to fail tests when this SevereDeprecationWarning captured

Originally posted by @zhukovgreen in https://github.com/oamg/leapp/diffs

@deprecated(since="2021-06-01", message="Some message")
class SomeModel:
    pass

Let's assume some user has in-house actor, which uses SomeModel. And this actor covered by tests.
In this case, before 2021-06-01 the test will be passing, just warnings will be notified, but after 2021-06-01 tests will start failing.

Nothing more - the actor will still work, only tests will fail. If there aren't tests, then no warnings and no failures at all (until we really remove the model at least).

This mechanism could also allow us to trace suppressed deprecated warnings which have expired deprecation notice (our tests will start failing). And we would need to update the date.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions