Add test coverage report in documentation
Now tests are run through the coverage utility and a report is generated and available in the FAQ of the html doc.
This commit is contained in:
parent
bdd3c7c941
commit
047458dcf6
2
Makefile
2
Makefile
|
@ -61,7 +61,7 @@ clean:
|
||||||
|
|
||||||
venv:
|
venv:
|
||||||
@virtualenv --python=python3 --system-site-packages ci_venv $(SUPPRESS_OUPUT)
|
@virtualenv --python=python3 --system-site-packages ci_venv $(SUPPRESS_OUPUT)
|
||||||
@. "./ci_venv/bin/activate" && pip install --upgrade pip numpy ase h5py lxml pint terminaltables pycairo sphinx $(SUPPRESS_OUPUT)
|
@. "./ci_venv/bin/activate" && pip install --upgrade pip numpy ase h5py lxml pint terminaltables pycairo sphinx coverage $(SUPPRESS_OUPUT)
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
@echo "Building pdf and html documentation..."
|
@echo "Building pdf and html documentation..."
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
# You can set these variables from the command line.
|
# You can set these variables from the command line.
|
||||||
SPHINXOPTS =
|
SPHINXOPTS =
|
||||||
SPHINXBUILD = python -m sphinx
|
SPHINXBUILD = sphinx-build
|
||||||
PAPER =
|
PAPER =
|
||||||
BUILDDIR = build
|
BUILDDIR = build
|
||||||
|
|
||||||
|
@ -83,9 +83,13 @@ html0: banner images
|
||||||
@echo
|
@echo
|
||||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||||
|
|
||||||
html: html0 ownership $(BUILDDIR)/html/sitemap.xml
|
html: html0 ownership $(BUILDDIR)/html/sitemap.xml coverage_report
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
coverage_report:
|
||||||
|
@echo "Generating coverage report..."
|
||||||
|
@mv source/htmlcov $(BUILDDIR)/html/_static
|
||||||
|
|
||||||
dirhtml:
|
dirhtml:
|
||||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||||
@echo
|
@echo
|
||||||
|
|
|
@ -20,6 +20,8 @@ import sys, os
|
||||||
sys.path.insert(0, os.path.abspath('.'))
|
sys.path.insert(0, os.path.abspath('.'))
|
||||||
sys.path.insert(0, os.path.abspath('../src'))
|
sys.path.insert(0, os.path.abspath('../src'))
|
||||||
sys.path.insert(0, os.path.abspath('../src/msspec'))
|
sys.path.insert(0, os.path.abspath('../src/msspec'))
|
||||||
|
sys.path.insert(0, os.path.abspath('../../src'))
|
||||||
|
sys.path.insert(0, os.path.abspath('../../src/msspec'))
|
||||||
#sys.path.insert(0, os.path.abspath('../'))
|
#sys.path.insert(0, os.path.abspath('../'))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
.. _coverage_report_faq:
|
||||||
|
|
||||||
|
Test coverage
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<iframe src="../../_static/htmlcov/index.html" height="600px" width="100%"></iframe>
|
|
@ -7,3 +7,4 @@ FAQ
|
||||||
.. toctree::
|
.. toctree::
|
||||||
|
|
||||||
hemispherical_cluster/hemispherical_cluster
|
hemispherical_cluster/hemispherical_cluster
|
||||||
|
coverage_report/coverage_report
|
||||||
|
|
|
@ -27,7 +27,12 @@ results: pybinding
|
||||||
|
|
||||||
tests: pybinding
|
tests: pybinding
|
||||||
@echo "Runing unittests"
|
@echo "Runing unittests"
|
||||||
@python -c "from msspec.tests import run_tests; run_tests()" 1>/dev/null
|
# @python -c "from msspec.tests import run_tests; run_tests()" 1>/dev/null
|
||||||
|
@coverage run --source=./ --omit=msspec/es/*,msspec/msspecgui/* msspec/tests.py 1>/dev/null
|
||||||
|
# create the html coverage report
|
||||||
|
# @mv .coverage ../doc/source
|
||||||
|
@coverage html -d ../doc/source/htmlcov
|
||||||
|
@rm .coverage
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "Cleaning all..."
|
@echo "Cleaning all..."
|
||||||
|
|
|
@ -24,7 +24,7 @@ def Apollonius_CCC(circles_data) :
|
||||||
rmin=min(circles_data[1])
|
rmin=min(circles_data[1])
|
||||||
nbmin=circles_data[1].count(rmin)#So it is the number of circles with the smallest radius
|
nbmin=circles_data[1].count(rmin)#So it is the number of circles with the smallest radius
|
||||||
if nbmin==1 : #then we have 1 little circle, we go to Apollonius CCP
|
if nbmin==1 : #then we have 1 little circle, we go to Apollonius CCP
|
||||||
|
pass
|
||||||
elif nbmin==2: #then we have 2 little circles, we go to Apollonius CPP
|
elif nbmin==2: #then we have 2 little circles, we go to Apollonius CPP
|
||||||
if r1!=rmin :
|
if r1!=rmin :
|
||||||
data=[[O1,r1],O2,O3]
|
data=[[O1,r1],O2,O3]
|
||||||
|
|
|
@ -54,16 +54,16 @@ def compare_sym(Nsym,Osym):
|
||||||
print("New number of sym :", N)
|
print("New number of sym :", N)
|
||||||
if N>O :
|
if N>O :
|
||||||
output=2
|
output=2
|
||||||
print "Symmetries gained. Symmetry-list updated"
|
print("Symmetries gained. Symmetry-list updated")
|
||||||
elif O==1 :
|
elif O==1 :
|
||||||
output=-1
|
output=-1
|
||||||
print "No symmetry existing to help at decision"
|
print("No symmetry existing to help at decision")
|
||||||
elif N == O:
|
elif N == O:
|
||||||
output=1
|
output=1
|
||||||
print "Symmetry has been conserved."
|
print("Symmetry has been conserved.")
|
||||||
elif N<O :
|
elif N<O :
|
||||||
output=0
|
output=0
|
||||||
print "Symmetries Lost: Fusion-Operation on last empty-spheres advised"
|
print("Symmetries Lost: Fusion-Operation on last empty-spheres advised")
|
||||||
return output
|
return output
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
def read_sym_file(symfile) :
|
def read_sym_file(symfile) :
|
||||||
|
@ -279,7 +279,7 @@ def Cluster_emptyness_informations(Structure) :
|
||||||
raw_input("\nPress Enter to continue ...\n")
|
raw_input("\nPress Enter to continue ...\n")
|
||||||
|
|
||||||
Allproportions.append(proportion)
|
Allproportions.append(proportion)
|
||||||
print "AllProportions : ",Allproportions
|
print("AllProportions : ",Allproportions)
|
||||||
|
|
||||||
print("Hull volume = {}".format(set_volume))
|
print("Hull volume = {}".format(set_volume))
|
||||||
return spheres_volume / set_volume * 100
|
return spheres_volume / set_volume * 100
|
||||||
|
@ -341,7 +341,7 @@ def Vertice_Sphere_Proportion(O,hull,Structure) :
|
||||||
V1 = tool.vector_def(Point_list[O], P1)
|
V1 = tool.vector_def(Point_list[O], P1)
|
||||||
V2 = tool.vector_def(Point_list[O], P2)
|
V2 = tool.vector_def(Point_list[O], P2)
|
||||||
V3 = tool.vector_def(Point_list[O], P3)
|
V3 = tool.vector_def(Point_list[O], P3)
|
||||||
print "Vectors from top of pyramid to base points" , [V1, V2, V3]
|
print("Vectors from top of pyramid to base points" , [V1, V2, V3])
|
||||||
a = tool.angle_vector(V1, V2)
|
a = tool.angle_vector(V1, V2)
|
||||||
b = tool.angle_vector(V2, V3)
|
b = tool.angle_vector(V2, V3)
|
||||||
c = tool.angle_vector(V3, V1)
|
c = tool.angle_vector(V3, V1)
|
||||||
|
@ -430,7 +430,7 @@ def convex_base(Neil,Simplices) :
|
||||||
Last=ConvBase[-1]
|
Last=ConvBase[-1]
|
||||||
print(Last)
|
print(Last)
|
||||||
Neighborsi=hull_search_neighbors(i,Simplices)
|
Neighborsi=hull_search_neighbors(i,Simplices)
|
||||||
print ("The last elements :{}\nHis neighbors : {}".format(ConvBase[-1],Neighborsi))
|
print("The last elements :{}\nHis neighbors : {}".format(ConvBase[-1],Neighborsi))
|
||||||
if ConvBase[-1] in Neighborsi :
|
if ConvBase[-1] in Neighborsi :
|
||||||
ConvBase.append(i)
|
ConvBase.append(i)
|
||||||
Rest.remove(i)
|
Rest.remove(i)
|
||||||
|
@ -459,7 +459,7 @@ def Hull_Neighbors_List(O,Structure,hull) :
|
||||||
# Returns the list of all atom's indexes in hull wich are neighbors of Atom indexed numAtom (numAtom must be int, 0 included)
|
# Returns the list of all atom's indexes in hull wich are neighbors of Atom indexed numAtom (numAtom must be int, 0 included)
|
||||||
Allfacets = np.ndarray.tolist(hull.simplices)
|
Allfacets = np.ndarray.tolist(hull.simplices)
|
||||||
Hull_Neilist = []
|
Hull_Neilist = []
|
||||||
print Allfacets
|
print(Allfacets)
|
||||||
for facet in Allfacets :
|
for facet in Allfacets :
|
||||||
if O in facet :
|
if O in facet :
|
||||||
for index in facet :
|
for index in facet :
|
||||||
|
|
|
@ -179,9 +179,9 @@ class BulkGui(dataflow.IOperatorCreator.IAction):
|
||||||
if result == wx.ID_OK:
|
if result == wx.ID_OK:
|
||||||
print("execute_on_operator : signaling operator %d as modified" % operator.id)
|
print("execute_on_operator : signaling operator %d as modified" % operator.id)
|
||||||
operator.data_flow.on_modified_operator(operator)
|
operator.data_flow.on_modified_operator(operator)
|
||||||
print "OK"
|
print("OK")
|
||||||
else:
|
else:
|
||||||
print "Cancel"
|
print("Cancel")
|
||||||
dialog.Destroy()
|
dialog.Destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ class GLPanel(wx.Panel):
|
||||||
else:
|
else:
|
||||||
self.scale /= 1.1
|
self.scale /= 1.1
|
||||||
#self._gl_scale()
|
#self._gl_scale()
|
||||||
print self.scale
|
print(self.scale)
|
||||||
w, h = self.canvas.GetClientSize()
|
w, h = self.canvas.GetClientSize()
|
||||||
self._gl_init_view(w, h)
|
self._gl_init_view(w, h)
|
||||||
self._gl_draw()
|
self._gl_draw()
|
||||||
|
@ -82,7 +82,7 @@ class GLPanel(wx.Panel):
|
||||||
winz = glReadPixels(winx, winy, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT)[0][0]
|
winz = glReadPixels(winx, winy, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT)[0][0]
|
||||||
coords = gluUnProject(winx, winy, winz, mvmatrix, projmatrix, viewport)
|
coords = gluUnProject(winx, winy, winz, mvmatrix, projmatrix, viewport)
|
||||||
self.coords0 = coords
|
self.coords0 = coords
|
||||||
print "coords0 = ", coords
|
print("coords0 = ", coords)
|
||||||
|
|
||||||
|
|
||||||
def onMotionEvent(self, event):
|
def onMotionEvent(self, event):
|
||||||
|
@ -112,10 +112,10 @@ class GLPanel(wx.Panel):
|
||||||
translation = [x - self.coords0[0], y - self.coords0[1], 0]
|
translation = [x - self.coords0[0], y - self.coords0[1], 0]
|
||||||
#print x, y, z#translation
|
#print x, y, z#translation
|
||||||
if winx < w and winx > 0 and winy < h and winy > 0:
|
if winx < w and winx > 0 and winy < h and winy > 0:
|
||||||
print 'here'
|
print('here')
|
||||||
glTranslatef(*translation)
|
glTranslatef(*translation)
|
||||||
#self.translation = translation
|
#self.translation = translation
|
||||||
print translation
|
print(translation)
|
||||||
|
|
||||||
self._gl_draw()
|
self._gl_draw()
|
||||||
|
|
||||||
|
|
|
@ -151,3 +151,7 @@ def create_tests_results():
|
||||||
|
|
||||||
def delete_results_file():
|
def delete_results_file():
|
||||||
os.remove(RESULTS_FILENAME)
|
os.remove(RESULTS_FILENAME)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
run_tests()
|
||||||
|
|
Loading…
Reference in New Issue