def test_extend_default_ignore_list(): freezegun.configure(extend_ignore_list=['tensorflow']) with mock.patch("freezegun.api._freeze_time.__init__", return_value=None) as _freeze_time_init_mock: freezegun.freeze_time("2020-10-06") expected_ignore_list = [ 'nose.plugins', 'six.moves', 'django.utils.six.moves', 'google.gax', 'threading', 'Queue', 'selenium', '_pytest.terminal.', '_pytest.runner.', 'gi', 'tensorflow', ] _freeze_time_init_mock.assert_called_once_with( time_to_freeze_str="2020-10-06", tz_offset=None, ignore=expected_ignore_list, tick=False, as_arg=False, as_kwarg='', auto_tick_seconds=0, )
def test_default_ignore_list_is_overridden(): freezegun.configure(default_ignore_list=['threading', 'tensorflow']) with mock.patch("freezegun.api._freeze_time.__init__", return_value=None) as _freeze_time_init_mock: freezegun.freeze_time("2020-10-06") expected_ignore_list = [ 'threading', 'tensorflow', ] _freeze_time_init_mock.assert_called_once_with( time_to_freeze_str="2020-10-06", tz_offset=None, ignore=expected_ignore_list, tick=False, as_arg=False, as_kwarg='', auto_tick_seconds=0, )
import asyncio import logging import os import typing import freezegun import pytest import respx from mergify_engine import config from mergify_engine import logs from mergify_engine import redis_utils from mergify_engine.clients import github # for jwt generation freezegun.configure( # type:ignore[attr-defined] extend_ignore_list=["mergify_engine.clients.github_app"]) original_os_environ = os.environ.copy() @pytest.fixture() def original_environment_variables( monkeypatch: pytest.MonkeyPatch, ) -> typing.Generator[None, None, None]: current = os.environ.copy() os.environ.clear() os.environ.update(original_os_environ) try: yield finally: os.environ.clear() os.environ.update(current)
def extend_freezegun_ignore_list(): """Extend the freezegun ignore list""" import freezegun freezegun.configure(extend_ignore_list=GLOBAL_FREEZEGUN_IGNORE_LIST)
import pytest from freezegun import freeze_time import submarine from submarine.entities.model_registry import ModelVersion, RegisteredModel from submarine.entities.model_registry.model_stages import ( STAGE_ARCHIVED, STAGE_DEVELOPING, STAGE_NONE, STAGE_PRODUCTION, ) from submarine.exceptions import SubmarineException from submarine.store.database import models from submarine.store.model_registry.sqlalchemy_store import SqlAlchemyStore freezegun.configure(default_ignore_list=["threading", "tensorflow"]) @pytest.mark.e2e class TestSqlAlchemyStore(unittest.TestCase): def setUp(self): submarine.set_db_uri( "mysql+pymysql://submarine_test:password_test@localhost:3306/submarine_test" ) self.db_uri = submarine.get_db_uri() self.store = SqlAlchemyStore(self.db_uri) def tearDown(self): submarine.set_db_uri(None) models.Base.metadata.drop_all(self.store.engine)