Skip to content

Commit

Permalink
test: fix flakey test
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Apr 16, 2024
1 parent 0f59901 commit fc346c1
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tests/functional/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

from ape.logging import LogLevel
from ape.plugins._utils import (
ApePluginsRepr,
ModifyPluginResultHandler,
Expand Down Expand Up @@ -263,21 +264,12 @@ def test_repr_when_exception(self, mocker):
assert repr(group) == "<PluginGroup>"


def test_handle_upgrade_result_when_upgrading_to_same_version(caplog, logger):
def test_handle_upgrade_result_when_upgrading_to_same_version(ape_caplog, logger):
plugin = PluginMetadata(name=THIRD_PARTY[0], version=f"0.{ape_version.minor}.0")
handler = ModifyPluginResultHandler(plugin)
ape_caplog.set_levels(LogLevel.INFO)
handler.handle_upgrade_result(0, f"0.{ape_version.minor}.0")
if records := caplog.records:
assert (
f"'{THIRD_PARTY[0]}' already has version '0.{ape_version.minor}.0'"
in records[-1].message
)
else:
version_at_end = plugin.version
pytest.fail(
f"Missing logs when upgrading to same version 0.{ape_version.minor}.0. "
f"version={version_at_end}"
)
assert f"'{THIRD_PARTY[0]}' already has version '0.{ape_version.minor}.0'" in ape_caplog.head


class TestApeVersion:
Expand Down

0 comments on commit fc346c1

Please sign in to comment.