3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-21 20:03:41 +01:00

Merge pull request #105 from gkraberger/test_improvements

Test improvements
This commit is contained in:
Manuel Zingl 2018-10-04 15:27:11 -04:00 committed by GitHub
commit f4ad91f8b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 84 additions and 59 deletions

View File

@ -45,13 +45,28 @@ add_subdirectory(fortran/dmftproj)
message(STATUS "TRIQS : Adding compilation flags detected by the library (C++11/14, libc++, etc...) ")
add_subdirectory(c++)
add_subdirectory(python)
add_subdirectory(python python/triqs_dft_tools)
add_subdirectory(shells)
#------------------------
# tests
#------------------------
option(TEST_COVERAGE "Analyze the coverage of tests" OFF)
# perform tests with coverage info
if (${TEST_COVERAGE})
# we try to locate the coverage program
find_program(PYTHON_COVERAGE python-coverage)
find_program(PYTHON_COVERAGE coverage)
if(NOT PYTHON_COVERAGE)
message(FATAL_ERROR "Program coverage (or python-coverage) not found.\nEither set PYTHON_COVERAGE explicitly or disable TEST_COVERAGE!\nYou need to install the python package coverage, e.g. with\n pip install coverage\nor with\n apt install python-coverage")
endif()
message(STATUS "Setting up test coverage")
add_custom_target(coverage ${PYTHON_COVERAGE} combine --append .coverage plovasp/.coverage || true COMMAND ${PYTHON_COVERAGE} html COMMAND echo "Open ${CMAKE_BINARY_DIR}/test/htmlcov/index.html in browser!" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test)
endif()
enable_testing()
option(Build_Tests "Build the tests of the library " ON)

View File

@ -4,6 +4,7 @@
import sys
sys.path.insert(0, "@TRIQS_SPHINXEXT_PATH@/numpydoc")
sys.path.insert(0, "@CMAKE_BINARY_DIR@/python")
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.mathjax',

View File

@ -123,3 +123,7 @@ Functionality of ``dft_tools`` can be tweaked using extra compile-time options p
+---------------------------------------------------------------+-----------------------------------------------+
| Build the documentation locally | -DBuild_Documentation=ON |
+---------------------------------------------------------------+-----------------------------------------------+
| Check test coverage when testing | -DTEST_COVERAGE=ON |
| (run ``make coverage`` to show the results; requires the | |
| python ``coverage`` package) | |
+---------------------------------------------------------------+-----------------------------------------------+

View File

@ -7,8 +7,14 @@ FILE(COPY SrVO3.pmat SrVO3.struct SrVO3.outputs SrVO3.oubwin SrVO3.ctqmcout SrVO
# List all tests
set(all_tests wien2k_convert hk_convert w90_convert sumkdft_basic srvo3_Gloc srvo3_transp sigma_from_file blockstructure analyse_block_structure_from_gf analyse_block_structure_from_gf2)
set(python_executable python)
if(${TEST_COVERAGE})
set(python_executable ${PYTHON_COVERAGE} run --append --source "${CMAKE_BINARY_DIR}/python" )
endif()
foreach(t ${all_tests})
add_test(NAME ${t} COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/${t}.py)
add_test(NAME ${t} COMMAND ${python_executable} ${CMAKE_CURRENT_SOURCE_DIR}/${t}.py)
endforeach()
# Set the PythonPath : put the build dir first (in case there is an installed version).
@ -17,4 +23,3 @@ set_property(TEST ${all_tests} PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DI
# VASP converter tests
add_subdirectory(plovasp)

View File

@ -1,5 +1,5 @@
from pytriqs.gf import *
from sumk_dft import SumkDFT
from triqs_dft_tools.sumk_dft import SumkDFT
from scipy.linalg import expm
import numpy as np
from pytriqs.utility.comparison_tests import assert_gfs_are_close, assert_arrays_are_close, assert_block_gfs_are_close

View File

@ -1,5 +1,5 @@
from pytriqs.gf import *
from sumk_dft import SumkDFT
from triqs_dft_tools.sumk_dft import SumkDFT
import numpy as np
from pytriqs.utility.comparison_tests import assert_block_gfs_are_close

View File

@ -1,8 +1,8 @@
from sumk_dft import *
from triqs_dft_tools.sumk_dft import *
from pytriqs.utility.h5diff import h5diff
from pytriqs.gf import *
from pytriqs.utility.comparison_tests import assert_block_gfs_are_close
from block_structure import BlockStructure
from triqs_dft_tools.block_structure import BlockStructure
SK = SumkDFT('blockstructure.in.h5',use_dft_blocks=True)

View File

@ -25,7 +25,7 @@ from pytriqs.archive import *
from pytriqs.utility.h5diff import h5diff
import pytriqs.utility.mpi as mpi
from converters import *
from triqs_dft_tools.converters import *
Converter = HkConverter(filename='hk_convert_hamiltonian.hk',hdf_filename='hk_convert.out.h5')

View File

@ -12,7 +12,7 @@ FILE(COPY ${all_tests} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
FILE(COPY run_suite.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
foreach(t ${all_tests})
add_test(NAME ${t} COMMAND python run_suite.py ${t})
add_test(NAME ${t} COMMAND ${python_executable} run_suite.py ${t})
endforeach()
set_property(TEST ${all_tests} PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} )

View File

@ -2,7 +2,7 @@
import os
import numpy as np
from converters.plovasp.atm import dos_tetra_weights_3d
from triqs_dft_tools.converters.plovasp.atm import dos_tetra_weights_3d
import mytest
################################################################################

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import arraytest
import numpy as np
from converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import arraytest
import numpy as np
from converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import arraytest
import numpy as np
from converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import arraytest
import numpy as np
from converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import arraytest
import numpy as np
from converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import arraytest
import numpy as np
from converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
################################################################################
#

View File

@ -3,7 +3,7 @@ Tests of 'read_plocar()' from module 'plocar_io.c_plocar_io'
"""
import mytest
import numpy as np
from plocar_io.c_plocar_io import read_plocar
from triqs_dft_tools.plocar_io.c_plocar_io import read_plocar
################################################################################
#

View File

@ -1,8 +1,8 @@
import converters.plovasp.vaspio
from converters.plovasp.inpconf import ConfigParameters
from converters.plovasp.plotools import check_data_consistency
from converters.plovasp.elstruct import ElectronicStructure
import triqs_dft_tools.converters.plovasp.vaspio
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.plotools import check_data_consistency
from triqs_dft_tools.converters.plovasp.elstruct import ElectronicStructure
import mytest
################################################################################

View File

@ -4,9 +4,9 @@ import rpath
_rpath = os.path.dirname(rpath.__file__) + '/'
import numpy as np
from converters.plovasp.inpconf import ConfigParameters
from converters.plovasp.proj_shell import ProjectorShell
from converters.plovasp.proj_group import ProjectorGroup
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.proj_shell import ProjectorShell
from triqs_dft_tools.converters.plovasp.proj_group import ProjectorGroup
import mytest
################################################################################

View File

@ -4,11 +4,11 @@ import rpath
_rpath = os.path.dirname(rpath.__file__) + '/'
import numpy as np
from converters.plovasp.vaspio import VaspData
from converters.plovasp.elstruct import ElectronicStructure
from converters.plovasp.inpconf import ConfigParameters
from converters.plovasp.proj_shell import ProjectorShell
from converters.plovasp.proj_group import ProjectorGroup
from triqs_dft_tools.converters.plovasp.vaspio import VaspData
from triqs_dft_tools.converters.plovasp.elstruct import ElectronicStructure
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.proj_shell import ProjectorShell
from triqs_dft_tools.converters.plovasp.proj_group import ProjectorGroup
from pytriqs.archive import HDFArchive
import mytest

View File

@ -4,11 +4,11 @@ import rpath
_rpath = os.path.dirname(rpath.__file__) + '/'
import numpy as np
from converters.plovasp.vaspio import VaspData
from converters.plovasp.elstruct import ElectronicStructure
from converters.plovasp.inpconf import ConfigParameters
from converters.plovasp.proj_shell import ProjectorShell
from converters.plovasp.proj_group import ProjectorGroup
from triqs_dft_tools.converters.plovasp.vaspio import VaspData
from triqs_dft_tools.converters.plovasp.elstruct import ElectronicStructure
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.proj_shell import ProjectorShell
from triqs_dft_tools.converters.plovasp.proj_group import ProjectorGroup
import mytest
################################################################################

View File

@ -4,11 +4,11 @@ import rpath
_rpath = os.path.dirname(rpath.__file__) + '/'
import numpy as np
from converters.plovasp.vaspio import VaspData
from converters.plovasp.elstruct import ElectronicStructure
from converters.plovasp.inpconf import ConfigParameters
from converters.plovasp.proj_shell import ProjectorShell
from converters.plovasp.proj_group import ProjectorGroup
from triqs_dft_tools.converters.plovasp.vaspio import VaspData
from triqs_dft_tools.converters.plovasp.elstruct import ElectronicStructure
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.proj_shell import ProjectorShell
from triqs_dft_tools.converters.plovasp.proj_group import ProjectorGroup
from pytriqs.archive import HDFArchive
import mytest

View File

@ -4,11 +4,11 @@ import rpath
_rpath = os.path.dirname(rpath.__file__) + '/'
import numpy as np
from converters.plovasp.vaspio import VaspData
from converters.plovasp.elstruct import ElectronicStructure
from converters.plovasp.inpconf import ConfigParameters
from converters.plovasp.proj_shell import ProjectorShell
from converters.plovasp.proj_group import ProjectorGroup
from triqs_dft_tools.converters.plovasp.vaspio import VaspData
from triqs_dft_tools.converters.plovasp.elstruct import ElectronicStructure
from triqs_dft_tools.converters.plovasp.inpconf import ConfigParameters
from triqs_dft_tools.converters.plovasp.proj_shell import ProjectorShell
from triqs_dft_tools.converters.plovasp.proj_group import ProjectorGroup
import mytest
################################################################################

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import mytest
import numpy as np
from converters.plovasp.vaspio import Doscar
from triqs_dft_tools.converters.plovasp.vaspio import Doscar
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import mytest
import numpy as np
from converters.plovasp.vaspio import Eigenval
from triqs_dft_tools.converters.plovasp.vaspio import Eigenval
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import mytest
import numpy as np
from converters.plovasp.vaspio import Kpoints
from triqs_dft_tools.converters.plovasp.vaspio import Kpoints
################################################################################
#

View File

@ -7,7 +7,7 @@ _rpath = os.path.dirname(rpath.__file__) + '/'
import mytest
import numpy as np
from converters.plovasp.vaspio import Poscar
from triqs_dft_tools.converters.plovasp.vaspio import Poscar
################################################################################
#

View File

@ -22,7 +22,7 @@
from pytriqs.archive import *
from pytriqs.gf import *
from pytriqs.gf.tools import *
from sumk_dft_tools import *
from triqs_dft_tools.sumk_dft_tools import *
from pytriqs.utility.comparison_tests import *
import numpy as np

View File

@ -21,8 +21,8 @@
from pytriqs.archive import *
from pytriqs.gf import *
from sumk_dft import *
from converters.wien2k_converter import *
from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.converters.wien2k_converter import *
from pytriqs.operators.util import set_operator_structure
from pytriqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff

View File

@ -20,9 +20,9 @@
################################################################################
from numpy import *
from converters.wien2k_converter import *
from sumk_dft import *
from sumk_dft_tools import *
from triqs_dft_tools.converters.wien2k_converter import *
from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.sumk_dft_tools import *
from pytriqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff

View File

@ -21,7 +21,7 @@
################################################################################
from pytriqs.archive import *
from sumk_dft_tools import SumkDFTTools
from triqs_dft_tools.sumk_dft_tools import SumkDFTTools
import pytriqs.utility.mpi as mpi
from pytriqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff

View File

@ -21,7 +21,7 @@
################################################################################
from converters import *
from triqs_dft_tools.converters import *
from pytriqs.archive import *
from pytriqs.utility.h5diff import h5diff
import pytriqs.utility.mpi as mpi

View File

@ -25,7 +25,7 @@ from pytriqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff
import pytriqs.utility.mpi as mpi
from converters import Wien2kConverter
from triqs_dft_tools.converters import Wien2kConverter
Converter = Wien2kConverter(filename='SrVO3')
Converter.hdf_file = 'wien2k_convert.out.h5'