This repository was archived by the owner on Apr 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ import inspect
2
+ import os
3
+ import pytest
4
+ import shutil
5
+
6
+ from hoverxref .translators import HoverXRefHTMLTranslatorMixin
7
+
8
+ from .utils import srcdir
9
+
10
+
11
+ @pytest .mark .sphinx (
12
+ srcdir = srcdir ,
13
+ buildername = 'latex' ,
14
+ confoverrides = {
15
+ 'hoverxref_project' : 'myproject' ,
16
+ 'hoverxref_version' : 'myversion' ,
17
+ },
18
+ )
19
+ def test_dont_override_translator_non_html_builder (app , status , warning ):
20
+ app .build ()
21
+ path = app .outdir / 'python.tex'
22
+ assert path .exists () is True
23
+ content = open (path ).read ()
24
+
25
+ assert app .builder .format == 'latex'
26
+ for name , klass in app .registry .translators .items ():
27
+ assert not issubclass (klass , HoverXRefHTMLTranslatorMixin )
28
+
29
+
30
+ @pytest .mark .sphinx (
31
+ srcdir = srcdir ,
32
+ buildername = 'html' ,
33
+ confoverrides = {
34
+ 'hoverxref_project' : 'myproject' ,
35
+ 'hoverxref_version' : 'myversion' ,
36
+ },
37
+ )
38
+ def test_override_translator_non_html_builder (app , status , warning ):
39
+ app .build ()
40
+ path = app .outdir / 'index.html'
41
+ assert path .exists () is True
42
+ content = open (path ).read ()
43
+
44
+ assert app .builder .format == 'html'
45
+ for name , klass in app .registry .translators .items ():
46
+ assert issubclass (klass , HoverXRefHTMLTranslatorMixin )
You can’t perform that action at this time.
0 commit comments