mirror of
https://github.com/triqs/dft_tools
synced 2024-09-01 08:43:41 +02:00
![Oleg E. Peil](/assets/img/avatar_default.png)
The names of the test suites have been prefixed with an underscore to avoid name conflicts with corresponding modules. Also an attempt to make a scan of all tests has been made by creating a 'test_all.py' script that is supposed to discover all test cases and run them. Unfortunately, this does not work as expected because many tests use input files assumed to be found in the current directory, which is not true if the tests are run from a different (parent) directory. This can be fixed by either forcing the change of directory (but it seems that 'unittest' does not have this functionality) or prepending input file names with the current module directory.
35 lines
922 B
Python
35 lines
922 B
Python
|
|
import vaspio
|
|
from inpconf import ConfigParameters
|
|
import mytest
|
|
|
|
################################################################################
|
|
#
|
|
# TestDataConsistency
|
|
#
|
|
################################################################################
|
|
class TestDataConsistency(mytest.MyTestCase):
|
|
"""
|
|
Function:
|
|
|
|
def read_plocar(filename)
|
|
|
|
Scenarios:
|
|
|
|
- **if** file PLOCAR does not exist **raise** IOError
|
|
- **if** PLOCAR is truncated **raise** IOError
|
|
- **if** the precision flag is not 4 or 8 **raise** ValueError
|
|
- **if** PLOCAR with prec=8 is read **compare** the output
|
|
- **if** PLOCAR with prec=4 is read **compare** the output
|
|
"""
|
|
# Scenario 1
|
|
def test_example(self):
|
|
conf_file = 'example.cfg'
|
|
pars = ConfigParameters(conf_file)
|
|
pars.parse_input()
|
|
vasp_data = vaspio.VaspData('./')
|
|
|
|
print pars.shells
|
|
print pars.groups
|
|
|