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

update test to expect the output of a new version of sphinx #349

Merged
Merged
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
28 changes: 25 additions & 3 deletions tests/test_project.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import subprocess
import sys
from sys import platform
from typing import Sequence

Expand Down Expand Up @@ -107,6 +108,8 @@ def test_generate_api_docs(baked_with_development_dependencies, project_env_bin_
assert (project_dir / 'docs' / '_build' / 'html' / 'index.html').exists()


@pytest.mark.skipif(sys.version_info < (3, 9), reason=
"requires python 3.9 or higher, see https://github.com/NLeSC/python-template/pull/347#issuecomment-1710684574")
def test_coverage_api_docs(baked_with_development_dependencies, project_env_bin_dir):
project_dir = baked_with_development_dependencies
bin_dir = project_env_bin_dir
Expand All @@ -116,9 +119,28 @@ def test_coverage_api_docs(baked_with_development_dependencies, project_env_bin_
assert 'build succeeded' in result.stdout
coverage_file = project_dir / 'docs' / '_build' / 'coverage' / 'python.txt'
coverage_file_lines = coverage_file.read_text('utf8').splitlines()
expected = ['Undocumented Python objects',
'===========================']
assert coverage_file_lines == expected
# Coverage file lines should look globally like:
# ['Undocumented Python objects',
# '===========================',
# '',
# 'Statistics',
# '----------',
# '',
# '+-----------------------------+----------+--------------+',
# '| Module | Coverage | Undocumented |',
# '+=============================+==========+==============+',
# '| my_python_package | 100.00% | 0 |',
# '+-----------------------------+----------+--------------+',
# '| my_python_package.my_module | 100.00% | 0 |',
# '+-----------------------------+----------+--------------+',
# '| TOTAL | 100.00% | 0 |',
# '+-----------------------------+----------+--------------+',
# ''
# ]
# The package coverage lines change order between runs, so we test for each data row individually:
assert '| my_python_package | 100.00% | 0 |' in coverage_file_lines
assert '| my_python_package.my_module | 100.00% | 0 |' in coverage_file_lines
assert '| TOTAL | 100.00% | 0 |' in coverage_file_lines


def test_doctest_api_docs(baked_with_development_dependencies, project_env_bin_dir):
Expand Down