-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: fix varioun versions of sphinx (#46)
Signed-off-by: Henry Schreiner <[email protected]>
- Loading branch information
Showing
3 changed files
with
26 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
import pytest | ||
|
||
from pathlib import Path | ||
import sys | ||
|
||
if sys.version_info < (3, 8): | ||
from importlib_metadata import version | ||
else: | ||
from importlib.metadata import version | ||
|
||
sphinx_vesion = tuple(int(d) for d in version("sphinx").split(".")[:2]) | ||
|
||
pytest_plugins = 'sphinx.testing.fixtures' | ||
|
||
@pytest.fixture(scope="session") | ||
def rootdir(): | ||
return Path(__file__).parent.absolute() / "roots" | ||
if sphinx_vesion < (7, 3): | ||
from sphinx.testing.path import path | ||
|
||
@pytest.fixture(scope="session") | ||
def rootdir(): | ||
return path(__file__).parent.abspath() / "roots" | ||
else: | ||
from pathlib import Path | ||
|
||
@pytest.fixture(scope="session") | ||
def rootdir(): | ||
return Path(__file__).parent.absolute() / "roots" |