Skip to content

Commit 365bc5c

Browse files
committed
Skip Sphinx test if Sphinx isn't installed
1 parent c287fb5 commit 365bc5c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/test_slots.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
import pickle
99
import weakref
1010
from pathlib import Path
11-
11+
from tempfile import TemporaryDirectory
1212
from unittest import mock
1313

1414
import pytest
15+
try:
16+
from sphinx.application import Sphinx
17+
except ImportError:
18+
Sphinx = None
1519

1620
import attr
1721
import attrs
@@ -745,10 +749,9 @@ def documented(self):
745749
"""A very well documented function"""
746750
return True
747751

752+
753+
@pytest.mark.skipif(Sphinx is None, reason="Sphinx is not installed")
748754
def test_sphinx_autodocuments_cached_property():
749-
from tempfile import TemporaryDirectory
750-
from sphinx.builders.text import TextBuilder
751-
from sphinx.application import Sphinx
752755
here = Path(__file__).parent
753756
with TemporaryDirectory() as td:
754757
tmp_path = Path(td)

0 commit comments

Comments
 (0)