Skip to content

Commit

Permalink
Make the tests pass with Sphinx 7.2
Browse files Browse the repository at this point in the history
This patch adapts the tests to work with Sphinx 7.2
  • Loading branch information
danigm committed Sep 4, 2023
1 parent ac97ce5 commit 03f1595
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/test_jquery_installed.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import base64
import hashlib
from pathlib import Path
from pathlib import Path, PosixPath

import pytest
import sphinx
from sphinx.testing.path import path
from sphinx.testing.util import SphinxTestApp

from sphinxcontrib.jquery import _FILES, _ROOT_DIR # NoQA
Expand All @@ -23,12 +22,22 @@ def run_blank_app(srcdir, **kwargs):
return Path(srcdir, "_build", "html")


class FakePath(PosixPath):
@classmethod
def _from_parts(cls, args, **kwargs):
cls._path = args[0]
return PosixPath._from_parts(args, **kwargs)

def resolve(self, *args, **kwargs):
return self._path


@pytest.fixture(scope="function")
def blank_app(tmpdir, monkeypatch):
def inner(**kwargs):
return run_blank_app(path(tmpdir), **kwargs)
return run_blank_app(Path(tmpdir), **kwargs)

monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
monkeypatch.setattr("sphinx.application._StrPath", FakePath)
yield inner


Expand Down

0 comments on commit 03f1595

Please sign in to comment.