diff --git a/testing/vcs/CMakeLists.txt b/testing/vcs/CMakeLists.txt index 643342c795..9a91e1ed1d 100644 --- a/testing/vcs/CMakeLists.txt +++ b/testing/vcs/CMakeLists.txt @@ -1206,7 +1206,95 @@ cdat_add_test(test_vcs_textextents ${BASELINE_DIR}/test_textextents.png ) +cdat_add_test(test_vcs_docstrings_boxfill + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_boxfill.py +) + +cdat_add_test(test_vcs_docstrings_Canvas + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_Canvas.py +) + +cdat_add_test(test_vcs_docstrings_colormap + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_colormap.py +) + +cdat_add_test(test_vcs_docstrings_displayplot + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_Canvas.py +) + +cdat_add_test(test_vcs_docstrings_fillarea + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_fillarea.py +) + +cdat_add_test(test_vcs_docstrings_isofill + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_isofill.py +) + +cdat_add_test(test_vcs_docstrings_isoline + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_isoline.py +) + +cdat_add_test(test_vcs_docstrings_line + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_line.py +) + +cdat_add_test(test_vcs_docstrings_manageElements + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_manageElements.py +) +cdat_add_test(test_vcs_docstrings_marker + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_marker.py +) + +cdat_add_test(test_vcs_docstrings_meshfill + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_meshfill.py +) + +cdat_add_test(test_vcs_docstrings_projection + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_projection.py +) + +cdat_add_test(test_vcs_docstrings_queries + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_queries.py +) + +cdat_add_test(test_vcs_docstrings_taylordiagram + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_taylordiagram.py +) + +cdat_add_test(test_vcs_docstrings_template + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_template.py +) + +cdat_add_test(test_vcs_docstrings_textcombined + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_textcombined.py +) + +cdat_add_test(test_vcs_docstrings_textorientation + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_textorientation.py +) + +cdat_add_test(test_vcs_docstrings_texttable + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_docstrings_texttable.py +) add_subdirectory(vtk_ui) add_subdirectory(editors) diff --git a/testing/vcs/test_vcs_docstrings_Canvas.py b/testing/vcs/test_vcs_docstrings_Canvas.py new file mode 100644 index 0000000000..5f1727bf11 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_Canvas.py @@ -0,0 +1,74 @@ +from vcs.Canvas import Canvas +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Canvas) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.Canvas") + diff --git a/testing/vcs/test_vcs_docstrings_boxfill.py b/testing/vcs/test_vcs_docstrings_boxfill.py new file mode 100644 index 0000000000..8e8f99e61d --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_boxfill.py @@ -0,0 +1,66 @@ +from vcs.boxfill import Gfb +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg", "new_box.json"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Gfb) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.boxfill") + diff --git a/testing/vcs/test_vcs_docstrings_colormap.py b/testing/vcs/test_vcs_docstrings_colormap.py new file mode 100644 index 0000000000..c75c02e11e --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_colormap.py @@ -0,0 +1,66 @@ +from vcs.colormap import Cp +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Cp) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.colormap") + diff --git a/testing/vcs/test_vcs_docstrings_displayplot.py b/testing/vcs/test_vcs_docstrings_displayplot.py new file mode 100644 index 0000000000..08d3812ac2 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_displayplot.py @@ -0,0 +1,66 @@ +from vcs.displayplot import Dp +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Dp) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.displayplot") + diff --git a/testing/vcs/test_vcs_docstrings_fillarea.py b/testing/vcs/test_vcs_docstrings_fillarea.py new file mode 100644 index 0000000000..5888d12f21 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_fillarea.py @@ -0,0 +1,66 @@ +from vcs.fillarea import Tf +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Tf) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.fillarea") + diff --git a/testing/vcs/test_vcs_docstrings_isofill.py b/testing/vcs/test_vcs_docstrings_isofill.py new file mode 100644 index 0000000000..5e0b70cf57 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_isofill.py @@ -0,0 +1,66 @@ +from vcs.isofill import Gfi +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Gfi) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.isofill") + diff --git a/testing/vcs/test_vcs_docstrings_isoline.py b/testing/vcs/test_vcs_docstrings_isoline.py new file mode 100644 index 0000000000..be17084512 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_isoline.py @@ -0,0 +1,66 @@ +from vcs.isoline import Gi +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Gi) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.isoline") + diff --git a/testing/vcs/test_vcs_docstrings_line.py b/testing/vcs/test_vcs_docstrings_line.py new file mode 100644 index 0000000000..e9338933f6 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_line.py @@ -0,0 +1,66 @@ +from vcs.line import Tl +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Tl) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.line") + diff --git a/testing/vcs/test_vcs_docstrings_manageElements.py b/testing/vcs/test_vcs_docstrings_manageElements.py new file mode 100644 index 0000000000..45ca59de47 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_manageElements.py @@ -0,0 +1,74 @@ +from vcs import manageElements +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(manageElements) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.manageElements") + diff --git a/testing/vcs/test_vcs_docstrings_marker.py b/testing/vcs/test_vcs_docstrings_marker.py new file mode 100644 index 0000000000..1fae4dd652 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_marker.py @@ -0,0 +1,74 @@ +from vcs.marker import Tm +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Tm) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.marker") + diff --git a/testing/vcs/test_vcs_docstrings_meshfill.py b/testing/vcs/test_vcs_docstrings_meshfill.py new file mode 100644 index 0000000000..fe8a371275 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_meshfill.py @@ -0,0 +1,66 @@ +from vcs.meshfill import Gfm +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Gfm) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.meshfill") + diff --git a/testing/vcs/test_vcs_docstrings_projection.py b/testing/vcs/test_vcs_docstrings_projection.py new file mode 100644 index 0000000000..02eb1e4351 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_projection.py @@ -0,0 +1,74 @@ +from vcs.projection import Proj +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Proj) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.projection") + diff --git a/testing/vcs/test_vcs_docstrings_queries.py b/testing/vcs/test_vcs_docstrings_queries.py new file mode 100644 index 0000000000..6f8e4e1edc --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_queries.py @@ -0,0 +1,66 @@ +from vcs import queries +import vcs.utils +import glob +import os +import doctest + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(queries) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + if obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.queries") + diff --git a/testing/vcs/test_vcs_docstrings_taylordiagram.py b/testing/vcs/test_vcs_docstrings_taylordiagram.py new file mode 100644 index 0000000000..ef6c1efcea --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_taylordiagram.py @@ -0,0 +1,74 @@ +from vcs.taylor import Gtd +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Gtd) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.taylor") + diff --git a/testing/vcs/test_vcs_docstrings_template.py b/testing/vcs/test_vcs_docstrings_template.py new file mode 100644 index 0000000000..a965711e91 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_template.py @@ -0,0 +1,74 @@ +from vcs.template import P +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(P) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.template") + diff --git a/testing/vcs/test_vcs_docstrings_textcombined.py b/testing/vcs/test_vcs_docstrings_textcombined.py new file mode 100644 index 0000000000..f3560842bc --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_textcombined.py @@ -0,0 +1,74 @@ +from vcs.textcombined import Tc +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Tc) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.textcombined") + diff --git a/testing/vcs/test_vcs_docstrings_textorientation.py b/testing/vcs/test_vcs_docstrings_textorientation.py new file mode 100644 index 0000000000..a183742339 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_textorientation.py @@ -0,0 +1,74 @@ +from vcs.textorientation import To +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(To) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.textorientation") + diff --git a/testing/vcs/test_vcs_docstrings_texttable.py b/testing/vcs/test_vcs_docstrings_texttable.py new file mode 100644 index 0000000000..6bb5b03760 --- /dev/null +++ b/testing/vcs/test_vcs_docstrings_texttable.py @@ -0,0 +1,74 @@ +from vcs.texttable import Tt +import vcs.utils +import glob +import os +import doctest + + +# for testing. remove when done +def find_obj(olist, name): + for obj in olist: + if obj.name == name: + return obj + print ("No object named " + name) + + +def cleanup(): + """Cleanup for the doctests. If some files aren't being deleted after testing, add their glob signature to the + patterns list. + """ + gb = glob.glob + patterns = ["example.*", "*.svg", "ex_*", "my*", "filename.*", "*.png", "deft_box.py", "*.mpeg"] + for pattern in patterns: + fnames = gb(pattern) + for name in fnames: + try: + os.remove(name) + except: + continue + +f = doctest.DocTestFinder(exclude_empty=False) +runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE) +objs = f.find(Tt) # list of objects with non-empty docstrings +failed = False +doctest_failed, no_doctest, no_docstring = [], [], [] +if not os.path.isdir(vcs.sample_data): + vcs.download_sample_data_files() # we need to have these for any example that uses slabs made from sample data +for obj in objs: + if obj.name.split('.')[-1][0] == '_' or obj.docstring.find('.. pragma: skip-doctest') >= 0: + continue # this is private or has been explicitly ignored; skip it. + elif obj.lineno is None: + continue # this is not actually something that can be documented; most likely came from __slots__. + if obj.docstring is '': + no_docstring.append(obj.name) # store for empty docstring warning + continue + examples = obj.examples + if len(examples) > 0: + # There are examples. Do they run? + results = runner.run(obj) + if results.failed > 0: + failed = True + doctest_failed.append(obj.name) + else: + # All docstrings not specifically skipped and non-empty require a doctest + failed = True + no_doctest.append(obj.name) +cleanup() # testing done + +# Report summary for cdash +if len(doctest_failed): + print "FAILING DOCTESTS:" + for name in doctest_failed: + print "\t" + name +if len(no_doctest): + print "MISSING DOCTESTS:" + for name in no_doctest: + print "\t" + name +if len(no_docstring): + print "NO DOCUMENTATION:" + for name in no_docstring: + print "\t" + name + +assert failed is False +print ("All doctests passed for vcs.texttable") +