mirror of
https://github.com/simonw/datasette.git
synced 2026-06-11 11:36:58 +02:00
datasette.fixtures module, closes #2733
https://gist.github.com/simonw/613be79094d491dd08f45e05f4f70691
This commit is contained in:
parent
d3330695fa
commit
1000d50220
10 changed files with 545 additions and 407 deletions
|
|
@ -3,6 +3,7 @@ Tests to ensure certain things are documented.
|
|||
"""
|
||||
|
||||
from datasette import app, utils
|
||||
import datasette.fixtures # noqa: F401
|
||||
from datasette.app import Datasette
|
||||
from datasette.filters import Filters
|
||||
from pathlib import Path
|
||||
|
|
@ -95,20 +96,17 @@ def test_table_filters_are_documented(documented_table_filters, subtests):
|
|||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def documented_fns():
|
||||
internals_rst = (docs_path / "internals.rst").read_text()
|
||||
# Any line that starts .. _internals_utils_X
|
||||
lines = internals_rst.split("\n")
|
||||
prefix = ".. _internals_utils_"
|
||||
return {
|
||||
line.split(prefix)[1].split(":")[0] for line in lines if line.startswith(prefix)
|
||||
}
|
||||
def documented_labels():
|
||||
labels = set()
|
||||
for filename in docs_path.glob("*.rst"):
|
||||
labels.update(get_labels(filename.name))
|
||||
return labels
|
||||
|
||||
|
||||
def test_functions_marked_with_documented_are_documented(documented_fns, subtests):
|
||||
def test_functions_marked_with_documented_are_documented(documented_labels, subtests):
|
||||
for fn in utils.functions_marked_as_documented:
|
||||
with subtests.test(fn=fn.__name__):
|
||||
assert fn.__name__ in documented_fns
|
||||
assert fn._datasette_docs_label in documented_labels
|
||||
|
||||
|
||||
def test_rst_heading_underlines_match_title_length():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue