Files
sigal/tests/conftest.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.0 KiB
Python
Raw Normal View History

2014-03-29 22:56:47 +01:00
import os
2020-03-15 22:58:03 -03:00
import shutil
import blinker
import PIL
2014-03-29 22:56:47 +01:00
import pytest
2018-02-16 23:36:52 +01:00
from sigal import signals
2014-03-29 22:56:47 +01:00
from sigal.settings import read_settings
CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
2023-02-12 17:31:08 +01:00
BUILD_DIR = os.path.join(CURRENT_DIR, "sample", "_build")
2023-02-12 17:31:08 +01:00
@pytest.fixture(scope="session", autouse=True)
def remove_build():
"""Ensure that build directory does not exists before each test."""
if os.path.exists(BUILD_DIR):
shutil.rmtree(BUILD_DIR)
2014-03-29 22:56:47 +01:00
@pytest.fixture
2014-03-29 22:56:47 +01:00
def settings():
"""Read the sample config file."""
2023-02-12 17:31:08 +01:00
return read_settings(os.path.join(CURRENT_DIR, "sample", "sigal.conf.py"))
2018-02-16 23:36:52 +01:00
@pytest.fixture()
def disconnect_signals():
# Reset plugins
yield None
for name in dir(signals):
2023-02-12 17:31:08 +01:00
if not name.startswith("_"):
2018-02-16 23:36:52 +01:00
try:
sig = getattr(signals, name)
if isinstance(sig, blinker.Signal):
sig.receivers.clear()
except Exception:
pass
def pytest_report_header(config):
2020-03-15 22:13:12 -03:00
return f"project deps: Pillow-{PIL.__version__}"