-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.6 backport] buffer deprecations to respect --quiet and --warn-erro…
…r-options (#10543)
- Loading branch information
1 parent
4c02a13
commit 4eeb570
Showing
7 changed files
with
111 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: respect --quiet and --warn-error-options for flag deprecations | ||
time: 2024-08-06T19:48:43.399453-04:00 | ||
custom: | ||
Author: michelleark | ||
Issue: "10105" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,36 @@ | ||
from dbt.internal_deprecations import deprecated | ||
from dbt.flags import set_from_args | ||
from argparse import Namespace | ||
import pytest | ||
|
||
import dbt.deprecations as deprecations | ||
|
||
@deprecated(reason="just because", version="1.23.0", suggested_action="Make some updates") | ||
def to_be_decorated(): | ||
return 5 | ||
|
||
@pytest.fixture(scope="function") | ||
def active_deprecations(): | ||
assert not deprecations.active_deprecations | ||
|
||
# simple test that the return value is not modified | ||
def test_deprecated_func(): | ||
set_from_args(Namespace(WARN_ERROR=False), None) | ||
assert hasattr(to_be_decorated, "__wrapped__") | ||
assert to_be_decorated() == 5 | ||
yield deprecations.active_deprecations | ||
|
||
deprecations.reset_deprecations() | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def buffered_deprecations(): | ||
assert not deprecations.buffered_deprecations | ||
|
||
yield deprecations.buffered_deprecations | ||
|
||
deprecations.buffered_deprecations.clear() | ||
|
||
|
||
def test_buffer_deprecation(active_deprecations, buffered_deprecations): | ||
deprecations.buffer("project-flags-moved") | ||
|
||
assert active_deprecations == set() | ||
assert len(buffered_deprecations) == 1 | ||
|
||
|
||
def test_fire_buffered_deprecations(active_deprecations, buffered_deprecations): | ||
deprecations.buffer("project-flags-moved") | ||
deprecations.fire_buffered_deprecations() | ||
|
||
assert active_deprecations == set(["project-flags-moved"]) | ||
assert len(buffered_deprecations) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from dbt.internal_deprecations import deprecated | ||
from dbt.flags import set_from_args | ||
from argparse import Namespace | ||
|
||
|
||
@deprecated(reason="just because", version="1.23.0", suggested_action="Make some updates") | ||
def to_be_decorated(): | ||
return 5 | ||
|
||
|
||
# simple test that the return value is not modified | ||
def test_deprecated_func(): | ||
set_from_args(Namespace(WARN_ERROR=False), None) | ||
assert hasattr(to_be_decorated, "__wrapped__") | ||
assert to_be_decorated() == 5 |