import pytest

from fmn.rules.cache import cache


@pytest.fixture(autouse=True, scope="session")
def configured_cache():
    cache.configure()

import pytest

from fmn.rules.cache import cache


@pytest.fixture(autouse=True)
def configured_cache():
    if not cache.region.is_configured:
        cache.configure()
    yield
    cache.region.invalidate()

Fix intermittent failures of test_guard_http_exception
Fix intermittent failures of test_guard_http_exception

Signed-off-by: Ryan Lerch <e809e25f3c554b2b195ccd768cd9a485288f896f@redhat.com>

  import pytest
  
  from fmn.rules.cache import cache
  
  
- @pytest.fixture(autouse=True, scope="session")
+ @pytest.fixture(autouse=True)
  def configured_cache():
+     if not cache.region.is_configured:
-     cache.configure()
+         cache.configure()
+     yield
+     cache.region.invalidate()
  
Fix intermittent failures of test_guard_http_exception
## Code Before:
import pytest

from fmn.rules.cache import cache


@pytest.fixture(autouse=True, scope="session")
def configured_cache():
    cache.configure()

## Instruction:
Fix intermittent failures of test_guard_http_exception
## Code After:
import pytest

from fmn.rules.cache import cache


@pytest.fixture(autouse=True)
def configured_cache():
    if not cache.region.is_configured:
        cache.configure()
    yield
    cache.region.invalidate()
