forked from junkafarian/sphinxfeed
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from JWCook/tests
This contribution greatly improves testing. Thanks to @JWCook for the good work!
- Loading branch information
Showing
28 changed files
with
370 additions
and
816 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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Pytest config for testing with SphinxTestApp | ||
Notes on testing setup: | ||
* A Sphinx test app is provided via `app` fixture from `sphinx.testing.fixtures`. | ||
* The `sources` dir contains source files and config to use for tests | ||
* Set via the `rootdir` fixture | ||
* A subdirectory to use for a specific test can be set by a pytest marker: | ||
* `@pytest.mark.sphinx("html", testroot="...") | ||
* This subdirectory must contain a conf.py and source files | ||
* The `outputs` dir contains expected output files | ||
* Test build output is located under `/tmp/pytest*` | ||
""" | ||
|
||
import shutil | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
collect_ignore = ["sources", "outputs"] | ||
pytest_plugins = "sphinx.testing.fixtures" | ||
|
||
OUTPUT_DIR = Path(__file__).parent.resolve() / "outputs" | ||
SOURCE_DIR = Path(__file__).parent.resolve() / "sources" | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def rootdir(): | ||
"""This fixture overrides the root directory used by SphinxTestApp. Also patches in a | ||
Path.copytree() method for compatibility with sphinx.testing.path.path in older Sphinx versions. | ||
""" | ||
|
||
class PatchedPath(type(Path())): | ||
def __new__(cls, *args): | ||
return super().__new__(cls, *args) | ||
|
||
def copytree(src, dest): | ||
shutil.copytree(src, dest, symlinks=True) | ||
|
||
yield PatchedPath(SOURCE_DIR) |
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.