File tree 6 files changed +21
-5
lines changed
6 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ jobs:
102
102
- name : Run tests for ${{ matrix.python-version }}
103
103
run : |
104
104
python -m pytest -vv
105
+ - name : Install matplotlib
106
+ run : |
107
+ python -m pip install matplotlib
108
+ - name : Run tests with matplotlib for ${{ matrix.python-version }}
109
+ run : |
110
+ python -m pytest -vv
105
111
106
112
build-docs :
107
113
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 1
1
sphinx
2
- matplotlib
3
2
wheel==0.37.1
4
3
pytest==7.1.3
5
4
beautifulsoup4==4.11.1
Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ furo==2022.9.29
3
3
sphinx == 5.2.3
4
4
sphinx-design
5
5
./
6
+ matplotlib
Original file line number Diff line number Diff line change 14
14
long_description_content_type = "text/markdown" ,
15
15
url = "https://github.com/wpilibsuite/sphinxext-opengraph" ,
16
16
license = "LICENSE.md" ,
17
- install_requires = ["sphinx>=4.0" , "matplotlib" ],
17
+ install_requires = ["sphinx>=4.0" ],
18
18
packages = ["sphinxext/opengraph" ],
19
19
include_package_data = True ,
20
20
package_data = {"sphinxext.opengraph" : ["sphinxext/opengraph/_static/*" ]},
Original file line number Diff line number Diff line change 8
8
from .descriptionparser import get_description
9
9
from .metaparser import get_meta_description
10
10
from .titleparser import get_title
11
- from .socialcards import create_social_card , DEFAULT_SOCIAL_CONFIG
11
+
12
+ try :
13
+ import matplotlib
14
+ except ImportError :
15
+ print ("matplotlib is not installed, social cards will not be generated" )
16
+ create_social_card = None
17
+ DEFAULT_SOCIAL_CONFIG = {}
18
+ else :
19
+ from .socialcards import create_social_card , DEFAULT_SOCIAL_CONFIG
12
20
13
21
import os
14
22
@@ -139,6 +147,7 @@ def get_tags(
139
147
if (
140
148
not (image_url or ogp_use_first_image )
141
149
and config_social .get ("enable" ) is not False
150
+ and create_social_card is not None
142
151
):
143
152
# Description
144
153
description_max_length = config_social .get (
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def test_meta_name_description(meta_tags):
40
40
41
41
42
42
@pytest .mark .sphinx ("html" , testroot = "meta-name-description-manual-description" )
43
- def test_meta_name_description (meta_tags ):
43
+ def test_meta_name_manual_description (meta_tags ):
44
44
og_description = get_tag_content (meta_tags , "description" )
45
45
description = get_meta_description (meta_tags )
46
46
@@ -49,7 +49,7 @@ def test_meta_name_description(meta_tags):
49
49
50
50
51
51
@pytest .mark .sphinx ("html" , testroot = "meta-name-description-manual-og-description" )
52
- def test_meta_name_description (meta_tags ):
52
+ def test_meta_name_manual_og_description (meta_tags ):
53
53
og_description = get_tag_content (meta_tags , "description" )
54
54
description = get_meta_description (meta_tags )
55
55
@@ -101,6 +101,7 @@ def test_image_alt(og_meta_tags):
101
101
@pytest .mark .sphinx ("html" , testroot = "simple" )
102
102
def test_image_social_cards (meta_tags ):
103
103
"""Social cards should automatically be added if no og:image is given."""
104
+ pytest .importorskip ("matplotlib" )
104
105
# Asserting `in` instead of `==` because of the hash that is generated
105
106
assert (
106
107
"http://example.org/en/latest/_images/social_previews/summary_index"
You can’t perform that action at this time.
0 commit comments