-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: generate doc tests in shell script
- Loading branch information
1 parent
0152b00
commit e0e4cfd
Showing
7 changed files
with
142 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
generate_tests() { | ||
local input_path=$1 | ||
local output_dir="tests/phmdoctest" | ||
local base=$(basename "$input_path" .md) | ||
local output_file="$output_dir/test_${base}.py" | ||
|
||
echo "Generating test for $input_path to $output_file" | ||
python -m phmdoctest "$input_path" --outfile "$output_file" | ||
} | ||
|
||
echo "Removing Previous Tests" | ||
rm -rf ./tests/phmdoctest | ||
mkdir ./tests/phmdoctest | ||
|
||
echo "Processing README.md" | ||
generate_tests "README.md" | ||
|
||
echo "Processing Markdown files in ./docs/docs" | ||
find ./docs/docs -name "*.md" -print0 | while IFS= read -r -d '' file; do | ||
generate_tests "$file" | ||
done | ||
|
||
echo "Don't Test Changelog" | ||
rm ./tests/phmdoctest/test_changelog.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters