Skip to content

Commit

Permalink
unit test deprecation buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Aug 7, 2024
1 parent 0694fd1 commit fdcb0b1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/unit/test_deprecations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import pytest

import dbt.deprecations as deprecations


@pytest.fixture(scope="function")
def active_deprecations():
assert not deprecations.active_deprecations

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

0 comments on commit fdcb0b1

Please sign in to comment.