Skip to content

Commit ac08486

Browse files
committed
tweak doc-build so test is more robust
1 parent 78194d6 commit ac08486

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

dash_slicer/docs.py

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import dash_slicer
77

88

9+
md_seperator = "<!--- The below is autogenerated - do not edit --->" # noqa
10+
11+
912
def dedent(text):
1013
"""Dedent a docstring, removing leading whitespace."""
1114
lines = text.lstrip().splitlines()

tests/test_docs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
from dash_slicer.docs import get_reference_docs
3+
from dash_slicer.docs import get_reference_docs, md_seperator
44

55

66
HERE = os.path.dirname(os.path.abspath(__file__))
@@ -18,7 +18,7 @@ def test_that_reference_docs_in_readme_are_up_to_date():
1818
assert os.path.isfile(filename)
1919
with open(filename, "rb") as f:
2020
text = f.read().decode()
21-
_, _, ref = text.partition("## Reference")
21+
_, _, ref = text.partition(md_seperator)
2222
ref1 = ref.strip().replace("\r\n", "\n")
2323
ref2 = get_reference_docs().strip()
2424
assert (

update_docs_in_readme.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55

66
import os
7-
from dash_slicer.docs import get_reference_docs
7+
from dash_slicer.docs import get_reference_docs, md_seperator
88

99

1010
HERE = os.path.dirname(os.path.abspath(__file__))
@@ -13,17 +13,15 @@
1313
def write_reference_docs():
1414
"""Write the reference docs to the README."""
1515
# Prepare
16-
header = "## Reference"
17-
note = "<!--- The below is autogenerated - do not edit --->"
1816
filename = os.path.join(HERE, "README.md")
1917
assert os.path.isfile(filename), "README.md not found"
2018
# Load first part of the readme
2119
with open(filename, "rb") as f:
2220
text = f.read().decode()
23-
text1, _, _ = text.partition(header)
21+
text1, _, _ = text.partition(md_seperator)
2422
text1 = text1.strip()
2523
# Create second part of the readme
26-
text2 = "\n\n\n" + header + "\n\n" + note + "\n\n" + get_reference_docs()
24+
text2 = "\n\n" + md_seperator + "\n\n" + get_reference_docs()
2725
if "\r" in text1:
2826
text2 = text2.replace("\n", "\r\n")
2927
# Wite

0 commit comments

Comments
 (0)