File: test_write_builder.py

package info (click to toggle)
sphinxext-rediraffe 0.3.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 944 kB
  • sloc: python: 1,361; makefile: 20
file content (39 lines) | stat: -rw-r--r-- 1,312 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
33
34
35
36
37
38
39
from __future__ import annotations

import pytest
from conftest import TESTS_ROOT


@pytest.fixture(scope='module')
def rootdir():
    return TESTS_ROOT / 'roots' / 'builder'


@pytest.mark.sphinx('rediraffewritediff', testroot='renamed_write_file_not_redirected')
def test_builder_renamed_file_write_not_redirected(app_init_repo):
    app_init_repo.build()
    valid_string = '"another.rst" "another2.rst"'
    redirects_text = (app_init_repo.srcdir / 'redirects.txt').read_text(
        encoding='utf-8'
    )
    assert valid_string in redirects_text


@pytest.mark.sphinx('rediraffewritediff', testroot='renamed_write_file_perc_low_fail')
def test_builder_renamed_file_write_perc_low_fail(app_init_repo):
    app_init_repo.build()
    valid_string = '"another.rst" "another2.rst"'
    redirects_text = (app_init_repo.srcdir / 'redirects.txt').read_text(
        encoding='utf-8'
    )
    assert valid_string not in redirects_text


@pytest.mark.sphinx('rediraffewritediff', testroot='renamed_write_file_perc_low_pass')
def test_builder_renamed_file_write_perc_low_pass(app_init_repo):
    app_init_repo.build()
    valid_string = '"another.rst" "another2.rst"'
    redirects_text = (app_init_repo.srcdir / 'redirects.txt').read_text(
        encoding='utf-8'
    )
    assert valid_string in redirects_text