File: test_devhelp.py

package info (click to toggle)
sphinxcontrib-devhelp 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 528 kB
  • sloc: python: 128; makefile: 8; sh: 7
file content (32 lines) | stat: -rw-r--r-- 844 bytes parent folder | download
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
31
32
"""Test for devhelp extension."""

from __future__ import annotations

from time import sleep
from typing import TYPE_CHECKING

import pytest

if TYPE_CHECKING:
    from sphinx.application import Sphinx


@pytest.mark.sphinx('devhelp', testroot='basic')
def test_basic(app: Sphinx) -> None:
    app.builder.build_all()


@pytest.mark.sphinx('devhelp', testroot='basic', freshenv=True)
def test_basic_deterministic_build(app: Sphinx) -> None:
    app.config.devhelp_basename, output_filename = 'testing', 'testing.devhelp.gz'

    app.builder.build_all()
    output_initial = (app.outdir / output_filename).read_bytes()

    sleep(2)

    app.builder.build_all()
    output_repeat = (app.outdir / output_filename).read_bytes()

    msg = f"Content of '{output_filename}' differed between builds."
    assert output_repeat == output_initial, msg