File: conftest.py

package info (click to toggle)
ablog 0.11.12-10
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 840 kB
  • sloc: python: 2,389; makefile: 45
file content (30 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pathlib import Path

import docutils
import pytest
import sphinx

# Load app, status and warning fixtures.
pytest_plugins = ["sphinx.testing.fixtures"]


# inspired from sphinx's conftest.py
def pytest_report_header(config):
    header = f"libraries: Sphinx-{sphinx.__display_version__}, docutils-{docutils.__version__}"
    if hasattr(config, "_tmp_path_factory"):
        header += f"\nbase tempdir: {config._tmp_path_factory.getbasetemp()}"

    return header


@pytest.fixture(scope="session")
def rootdir():
    return Path(__file__).parent.absolute() / "roots"


@pytest.fixture(scope="function", autouse=True)
def reset_blog_config():
    # Reset cached configurations to enable confoverrides
    from ablog.blog import Blog

    Blog._dict = {}