mirror of
https://github.com/triqs/dft_tools
synced 2024-11-06 22:23:52 +01:00
Improved the way test suites are executed
The main change is that `test_all.py` is now renamed to `run_suite.py`, with the latter being able to run a selected test suite if a corresponding command line argument (test suite directory name) is provided. CMakeLists are improved to copy each test suite separately to avoid copying unnecessary files. Also each test suite corresponds now to a separate CMake test.
This commit is contained in:
parent
3ce88a9457
commit
457df5d9b3
@ -2,11 +2,11 @@
|
||||
find_package(TriqsTest)
|
||||
|
||||
FILE(COPY SrVO3.h5 SrVO3_Sigma.h5 SrVO3.pmat SrVO3.struct SrVO3.outputs SrVO3.oubwin SrVO3.ctqmcout SrVO3.symqmc SrVO3.sympar SrVO3.parproj hk_convert_hamiltonian.hk DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
triqs_add_test_hdf(wien2k_convert " -p 1.e-6" )
|
||||
triqs_add_test_hdf(hk_convert " -p 1.e-6" )
|
||||
triqs_add_test_hdf(sumkdft_basic " -d 1.e-6" )
|
||||
triqs_add_test_hdf(srvo3_Gloc " -d 1.e-6" )
|
||||
triqs_add_test_hdf(srvo3_transp " -d 1.e-6" )
|
||||
triqs_add_test_hdf(sigma_from_file " -d 1.e-6" )
|
||||
#triqs_add_test_hdf(wien2k_convert " -p 1.e-6" )
|
||||
#triqs_add_test_hdf(hk_convert " -p 1.e-6" )
|
||||
#triqs_add_test_hdf(sumkdft_basic " -d 1.e-6" )
|
||||
#triqs_add_test_hdf(srvo3_Gloc " -d 1.e-6" )
|
||||
#triqs_add_test_hdf(srvo3_transp " -d 1.e-6" )
|
||||
#triqs_add_test_hdf(sigma_from_file " -d 1.e-6" )
|
||||
|
||||
add_subdirectory(plovasp)
|
||||
|
@ -1,4 +1,16 @@
|
||||
# load triqs helper to set up tests
|
||||
set(TestSuites
|
||||
inpconf
|
||||
plocar_io
|
||||
plotools
|
||||
proj_group
|
||||
proj_shell
|
||||
vaspio)
|
||||
|
||||
FILE(COPY plovasp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
FILE(COPY ${TestSuites} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
FILE(COPY run_suite.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
foreach(test_suite ${TestSuites})
|
||||
add_test(${test_suite}
|
||||
${PythonBuildExecutable} run_suite.py ${test_suite})
|
||||
endforeach(test_suite ${TestSuites})
|
||||
|
34
test/plovasp/run_suite.py
Normal file
34
test/plovasp/run_suite.py
Normal file
@ -0,0 +1,34 @@
|
||||
r"""
|
||||
Searches and runs all available test suites.
|
||||
"""
|
||||
import unittest
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 1:
|
||||
suite = unittest.TestLoader().discover('./')
|
||||
else:
|
||||
suite = unittest.TestLoader().discover(sys.argv[1] + '/')
|
||||
|
||||
# def list_tests(suite):
|
||||
# for test in suite:
|
||||
# if isinstance(test, unittest.TestSuite):
|
||||
# list_tests(test)
|
||||
# elif isinstance(test, unittest.TestCase):
|
||||
## print test.__class__.__bases__
|
||||
# tmp = test.__str__().split()
|
||||
# test_method, test_class = tmp[0], tmp[1]
|
||||
# test_class = test_class.strip('()')
|
||||
# print test_class + '.' + test_method
|
||||
|
||||
# list_tests(suite)
|
||||
results = unittest.TextTestRunner(verbosity=2, buffer=True).run(suite)
|
||||
# unittest.TextTestRunner(verbosity=2, buffer=False).run(suite)
|
||||
if results.wasSuccessful():
|
||||
raise SystemExit(0)
|
||||
else:
|
||||
print "Failed tests:"
|
||||
for failure in results.failures:
|
||||
print failurep[0].__str__()
|
||||
raise SystemExit(1)
|
||||
|
@ -1,10 +0,0 @@
|
||||
r"""
|
||||
Searches and runs all available test suites.
|
||||
"""
|
||||
import unittest
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().discover('./')
|
||||
unittest.TextTestRunner(verbosity=2, buffer=True).run(suite)
|
||||
# unittest.TextTestRunner(verbosity=2, buffer=False).run(suite)
|
||||
|
Loading…
Reference in New Issue
Block a user