Skip to content

Commit

Permalink
Replaces sphinx-testing with sphinx.testing
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Dec 20, 2021
1 parent 3726bb2 commit be6e707
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
12 changes: 12 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import pytest
from sphinx.testing.path import path


try:
import pytest_doctestplus.plugin
pytest_doctestplus
except ImportError:
raise ImportError("Install pytest-doctestplus to run the tests")


pytest_plugins = 'sphinx.testing.fixtures'


@pytest.fixture(scope='session')
def rootdir():
return path(__file__).parent.abspath() / 'tests/test-build'
17 changes: 8 additions & 9 deletions sphinx_math_dollar/tests/test_extension.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import os
import pytest

from sphinx_testing import with_app

@with_app(buildername='html', srcdir=os.path.join(os.path.dirname(__file__), 'test-build'),
copy_srcdir_to_tmpdir=True)
def _test_sphinx_build(app, status, warning):
def test(app):
# app is a Sphinx application object for default sphinx project (`tests/roots/test-root`).
app.build()


@pytest.mark.sphinx(buildername='html')
def test_sphinx_build(app):
app.build()
html = (app.outdir/'index.html').read_text()

Expand All @@ -21,8 +24,4 @@ def _test_sphinx_build(app, status, warning):
assert r"\[math\]" not in html
assert r"\[nomath\]" not in html

assert not status.read()
assert not warning.read()

def test_sphinx_build():
_test_sphinx_build()

0 comments on commit be6e707

Please sign in to comment.