File tree Expand file tree Collapse file tree 6 files changed +21
-5
lines changed Expand file tree Collapse file tree 6 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ jobs:
102102 - name : Run tests for ${{ matrix.python-version }}
103103 run : |
104104 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
105111
106112 build-docs :
107113 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 11sphinx
2- matplotlib
32wheel==0.37.1
43pytest==7.1.3
54beautifulsoup4==4.11.1
Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ furo==2022.9.29
33sphinx == 5.2.3
44sphinx-design
55./
6+ matplotlib
Original file line number Diff line number Diff line change 1414 long_description_content_type = "text/markdown" ,
1515 url = "https://github.com/wpilibsuite/sphinxext-opengraph" ,
1616 license = "LICENSE.md" ,
17- install_requires = ["sphinx>=4.0" , "matplotlib" ],
17+ install_requires = ["sphinx>=4.0" ],
1818 packages = ["sphinxext/opengraph" ],
1919 include_package_data = True ,
2020 package_data = {"sphinxext.opengraph" : ["sphinxext/opengraph/_static/*" ]},
Original file line number Diff line number Diff line change 88from .descriptionparser import get_description
99from .metaparser import get_meta_description
1010from .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
1220
1321import os
1422
@@ -139,6 +147,7 @@ def get_tags(
139147 if (
140148 not (image_url or ogp_use_first_image )
141149 and config_social .get ("enable" ) is not False
150+ and create_social_card is not None
142151 ):
143152 # Description
144153 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):
4040
4141
4242@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 ):
4444 og_description = get_tag_content (meta_tags , "description" )
4545 description = get_meta_description (meta_tags )
4646
@@ -49,7 +49,7 @@ def test_meta_name_description(meta_tags):
4949
5050
5151@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 ):
5353 og_description = get_tag_content (meta_tags , "description" )
5454 description = get_meta_description (meta_tags )
5555
@@ -101,6 +101,7 @@ def test_image_alt(og_meta_tags):
101101@pytest .mark .sphinx ("html" , testroot = "simple" )
102102def test_image_social_cards (meta_tags ):
103103 """Social cards should automatically be added if no og:image is given."""
104+ pytest .importorskip ("matplotlib" )
104105 # Asserting `in` instead of `==` because of the hash that is generated
105106 assert (
106107 "http://example.org/en/latest/_images/social_previews/summary_index"
You can’t perform that action at this time.
0 commit comments