From f7cf746c7e9031b485a94d9a60544c70192e5d26 Mon Sep 17 00:00:00 2001 From: vcatlett-nrao Date: Wed, 6 Dec 2023 19:29:14 -0500 Subject: [PATCH] Add a test for docstring coverage --- .docstr.yaml | 15 +++++++++++++++ src/dysh/tests/test_docstr.py | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .docstr.yaml create mode 100644 src/dysh/tests/test_docstr.py diff --git a/.docstr.yaml b/.docstr.yaml new file mode 100644 index 00000000..70931120 --- /dev/null +++ b/.docstr.yaml @@ -0,0 +1,15 @@ +paths: # list or string + - docstr_coverage +badge: docs # Path +exclude: .*/test # regex +verbose: 3 # int (0-4) +skip_magic: True # Boolean +skip_file_doc: True # Boolean +skip_init: True # Boolean +skip_class_def: True # Boolean +skip_private: True # Boolean +follow_links: True # Boolean +accept_empty: True # Boolean +ignore_names_file: .*/test # regex +fail_under: 90 # int +percentage_only: True # Boolean diff --git a/src/dysh/tests/test_docstr.py b/src/dysh/tests/test_docstr.py new file mode 100644 index 00000000..0b78bc4d --- /dev/null +++ b/src/dysh/tests/test_docstr.py @@ -0,0 +1,12 @@ +from docstr_coverage import analyze +from glob import glob + +def test_docstring_coverage(): + """ + Checks that the percentage of Python functions with docstrings + is >= 0% + """ + pyfiles = glob('./**/*.py', recursive = True) + coverage_report = analyze(pyfiles) + coverage = coverage_report.count_aggregate().coverage() + assert coverage >= 0 \ No newline at end of file