Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small fix for tests #91

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
python-version: ["3.8", "3.9"]
sphinx-version: [
"7.0.*",
"7.0.*", "7.1.*", "7.2.*",
"6.0.*",
"5.0.*",
"4.5", "4.4", "4.3", "4.2", "4.1", "4.0.*",
Expand All @@ -35,6 +35,9 @@ jobs:
sphinx-version: ""
- python-version: "3.11"
sphinx-version: "4.5"
exclude:
- python-version: "3.8"
sphinx-version: "7.2.*"

steps:
- uses: actions/checkout@v2
Expand Down
35 changes: 18 additions & 17 deletions tests/test_autodocsumm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import os.path as osp
import re
import bs4
import pytest
Expand All @@ -36,7 +37,7 @@ def in_between(full, sub, s0, *others):


def get_html(app, fname):
with open(app.outdir + '/' + fname) as f:
with open(osp.join(str(app.outdir), fname)) as f:
return f.read()


Expand Down Expand Up @@ -207,7 +208,7 @@ def test_module_nosignatures(self, app):

def test_class(self, app):
app.build()
html = get_html(app, '/test_class.html')
html = get_html(app, 'test_class.html')

if sphinx_version[:2] > [3, 1]:
assert in_autosummary("instance_attribute", html)
Expand Down Expand Up @@ -259,7 +260,7 @@ def test_class(self, app):
)
def test_class_order(self, app):
app.build()
html = get_html(app, '/test_class_order.html')
html = get_html(app, 'test_class_order.html')

if sphinx_version[:2] > [3, 1]:
assert in_autosummary("instance_attribute", html)
Expand All @@ -276,7 +277,7 @@ def test_class_order(self, app):

def test_class_summary_only(self, app):
app.build()
html = get_html(app, '/test_class_summary_only.html')
html = get_html(app, 'test_class_summary_only.html')

if sphinx_version[:2] > [3, 1]:
assert in_autosummary("instance_attribute", html)
Expand All @@ -300,7 +301,7 @@ def test_class_summary_only(self, app):

def test_class_nosignatures(self, app):
app.build()
html = get_html(app, '/test_class_nosignatures.html')
html = get_html(app, 'test_class_nosignatures.html')

if sphinx_version[:2] > [3, 1]:
assert in_autosummary("instance_attribute", html)
Expand All @@ -326,7 +327,7 @@ def test_class_nosignatures(self, app):

def test_inherited(self, app):
app.build()
html = get_html(app, '/test_inherited.html')
html = get_html(app, 'test_inherited.html')
assert in_autosummary("test_method", html)

@pytest.mark.xfail
Expand All @@ -341,7 +342,7 @@ def test_autoclasssumm_inline(self, app):
"""Test an AutoDocSummDirective inline."""
app.build()

html = get_html(app, '/test_autoclasssumm_inline.html')
html = get_html(app, 'test_autoclasssumm_inline.html')

methods_title = "<strong>Methods:</strong>"

Expand All @@ -357,7 +358,7 @@ def test_autoclasssumm_inline(self, app):
def test_class_submodule(self, app):
app.build()

html = get_html(app, '/test_class_submodule.html')
html = get_html(app, 'test_class_submodule.html')

# check that hyperlink for instance method exists in summary table
assert re.findall(r'<td>.*href="#dummy_submodule\.submodule1'
Expand All @@ -366,7 +367,7 @@ def test_class_submodule(self, app):
def test_module_submodule(self, app):
app.build()

html = get_html(app, '/test_module_submodule.html')
html = get_html(app, 'test_module_submodule.html')

# check that hyperlink for class exists in summary table
assert re.findall(r'<td>.*href="#dummy_submodule\.submodule2'
Expand All @@ -384,7 +385,7 @@ def test_autoclasssumm(self, app):
"""Test building the autosummary of a class."""
app.build()

html = get_html(app, '/test_autoclasssumm.html')
html = get_html(app, 'test_autoclasssumm.html')

# the class docstring must not be in the html
assert "Class test for autosummary" not in html
Expand All @@ -397,7 +398,7 @@ def test_autoclasssumm_no_titles(self, app):
"""Test building the autosummary of a class."""
app.build()

html = get_html(app, '/test_autoclasssumm_no_titles.html')
html = get_html(app, 'test_autoclasssumm_no_titles.html')

# the class docstring must not be in the html
assert "Class test for autosummary" not in html
Expand All @@ -412,7 +413,7 @@ def test_autoclasssumm_some_sections(self, app):
"""Test building the autosummary of a class with some sections only."""
app.build()

html = get_html(app, '/test_autoclasssumm_some_sections.html')
html = get_html(app, 'test_autoclasssumm_some_sections.html')

# the class docstring must not be in the html
assert "Class test for autosummary" not in html
Expand All @@ -426,7 +427,7 @@ def test_autoclasssumm_nosignatures(self, app):
"""Test building the autosummary of a class without signatures."""
app.build()

html = get_html(app, '/test_autoclasssumm_nosignatures.html')
html = get_html(app, 'test_autoclasssumm_nosignatures.html')

# the class docstring must not be in the html
assert "Class test for autosummary" not in html
Expand All @@ -441,7 +442,7 @@ def test_automodulesumm(self, app):
"""Test building the autosummary of a module."""
app.build()

html = get_html(app, '/test_automodulesumm.html')
html = get_html(app, 'test_automodulesumm.html')

# the class docstring must not be in the html
assert "Module for testing the autodocsumm" not in html
Expand All @@ -455,7 +456,7 @@ def test_automodulesumm_some_sections(self, app):
"""Test building the autosummary of a module with some sections only."""
app.build()

html = get_html(app, '/test_automodulesumm_some_sections.html')
html = get_html(app, 'test_automodulesumm_some_sections.html')

# the class docstring must not be in the html
assert "Module for testing the autodocsumm" not in html
Expand All @@ -469,7 +470,7 @@ def test_automodulesumm_nosignatures(self, app):
"""Test building the autosummary of a module without signatures."""
app.build()

html = get_html(app, '/test_automodulesumm_nosignatures.html')
html = get_html(app, 'test_automodulesumm_nosignatures.html')

# the class docstring must not be in the html
assert "Module for testing the autodocsumm" not in html
Expand All @@ -484,6 +485,6 @@ def test_automodulesumm_nosignatures(self, app):
def test_empty(self, app):
app.build()

html = get_html(app, '/test_empty.html')
html = get_html(app, 'test_empty.html')

assert not in_autosummary("product", html)
Loading