File tree Expand file tree Collapse file tree 4 files changed +47
-3
lines changed
Expand file tree Collapse file tree 4 files changed +47
-3
lines changed Original file line number Diff line number Diff line change 11pytest == 8.4.1
22pytest-cov == 6.2.1
33pdoc == 15.0.4
4- flake8 == 7.3.0
4+ flake8 == 7.3.0
5+ pdoc == 15.0.4
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ dependencies = [
1515dev = [
1616 " pytest==8.4.1" ,
1717 " pytest-cov==6.2.1" ,
18- " flake8==7.3.0"
18+ " flake8==7.3.0" ,
19+ " pdoc==15.0.4"
1920]
2021
2122[project .scripts ]
Original file line number Diff line number Diff line change @@ -193,6 +193,19 @@ def test_test_style():
193193 assert "Running style tests" in out
194194 assert "flake8" in out
195195
196+ # def test_doc_generate_html():
197+ # """Test -d h (generate HTML documentation)."""
198+ # code, out = run_tools(['-d', 'h'])
199+ # assert code == 0
200+ # assert 'Generating HTML documentation' in out
201+
202+
203+ def test_doc_invalid_arg ():
204+ """Test -d with invalid argument."""
205+ code , out = run_tools (['-d' , 'x' ])
206+ assert code == 1
207+ assert ("Unsupported argument" in out ) or ("Invalid doc mode" in out )
208+
196209
197210@pytest .mark .skipif (GITHUB_ACTIONS , reason = "Skipping test on GitHub Actions" )
198211def test_clean ():
Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ supported_installation_opts="d n"
55install=" "
66uninstall=0
77clean=0
8+ supported_doc_opts=" h s"
9+ doc=" "
810supported_test_opts=" p t a d s"
911test=" "
1012
11- while getopts " :i:t:chu" flag; do
13+ while getopts " :i:t:d: chu" flag; do
1214 case " ${flag} " in
1315 i) if [[ " $supported_installation_opts " =~ " $OPTARG " ]]; then
1416 install=" $OPTARG "
@@ -24,6 +26,12 @@ while getopts ":i:t:chu" flag; do
2426 echo " Unsupported argument '$OPTARG ' for '-$flag '. Please specify one of: $supported_test_opts " >&2 && exit 1;
2527 fi
2628 ;;
29+ d) if [[ " $supported_doc_opts " =~ " $OPTARG " ]]; then
30+ doc=" $OPTARG "
31+ else
32+ echo " Unsupported argument '$OPTARG ' for '-$flag '. Please specify one of: $supported_doc_opts " >&2 && exit 1;
33+ fi
34+ ;;
2735 h) cat README.md && exit 0;;
2836 :)
2937 echo " Option -$OPTARG requires an argument" >&2 ; exit 1;;
@@ -80,6 +88,27 @@ if [ -n "$test" ]; then
8088 esac
8189fi
8290
91+ # Documentation [-d]
92+ if [ -n " $doc " ]; then
93+ case " $doc " in
94+ h)
95+ echo " Generating HTML documentation..."
96+ if [ ! -d " stat_log_db/docs" ]; then
97+ mkdir -p stat_log_db/docs
98+ fi
99+ pdoc --output-dir stat_log_db/docs stat_log_db
100+ ;;
101+ s)
102+ echo " Hosting documentation..."
103+ pdoc stat_log_db --host localhost
104+ ;;
105+ * )
106+ echo " Invalid doc mode '$doc '. Use one of: $supported_doc_opts " >&2
107+ exit 1
108+ ;;
109+ esac
110+ fi
111+
83112# Clean artifacts [-c]
84113if [ $clean -eq 1 ]; then
85114 echo " Cleaning up workspace..."
You can’t perform that action at this time.
0 commit comments