mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
small change in read parameters, made tests available for auto-testing
This commit is contained in:
parent
5062f030c4
commit
a33d6897f0
2 changed files with 39 additions and 46 deletions
|
@ -7,43 +7,42 @@ import pyerrors as pe
|
|||
import pyerrors.input.openQCD as qcdin
|
||||
import pyerrors.input.sfcf as sfin
|
||||
import shutil
|
||||
import pytest
|
||||
|
||||
from time import sleep
|
||||
|
||||
def build_test_environment(type, cfgs, reps):
|
||||
if type == "o":
|
||||
def build_test_environment(env_type, cfgs, reps):
|
||||
if env_type == "o":
|
||||
for i in range(2,cfgs+1):
|
||||
shutil.copytree("data/sfcf_test/data_o/test_r0/cfg1","data/sfcf_test/data_o/test_r0/cfg"+str(i))
|
||||
shutil.copytree("tests/data/sfcf_test/data_o/test_r0/cfg1","tests/data/sfcf_test/data_o/test_r0/cfg"+str(i))
|
||||
for i in range(1,reps):
|
||||
shutil.copytree("data/sfcf_test/data_o/test_r0", "data/sfcf_test/data_o/test_r"+str(i))
|
||||
elif type == "c":
|
||||
shutil.copytree("tests/data/sfcf_test/data_o/test_r0", "tests/data/sfcf_test/data_o/test_r"+str(i))
|
||||
elif env_type == "c":
|
||||
for i in range(2,cfgs+1):
|
||||
shutil.copy("data/sfcf_test/data_c/data_c_r0/data_c_r0_n1","data/sfcf_test/data_c/data_c_r0/data_c_r0_n"+str(i))
|
||||
shutil.copy("tests/data/sfcf_test/data_c/data_c_r0/data_c_r0_n1","tests/data/sfcf_test/data_c/data_c_r0/data_c_r0_n"+str(i))
|
||||
for i in range(1,reps):
|
||||
os.mkdir("data/sfcf_test/data_c/data_c_r"+str(i))
|
||||
os.mkdir("tests/data/sfcf_test/data_c/data_c_r"+str(i))
|
||||
for j in range(1,cfgs+1):
|
||||
shutil.copy("data/sfcf_test/data_c/data_c_r0/data_c_r0_n1","data/sfcf_test/data_c/data_c_r"+str(i)+"/data_c_r"+str(i)+"_n"+str(j))
|
||||
shutil.copy("tests/data/sfcf_test/data_c/data_c_r0/data_c_r0_n1","tests/data/sfcf_test/data_c/data_c_r"+str(i)+"/data_c_r"+str(i)+"_n"+str(j))
|
||||
|
||||
|
||||
|
||||
|
||||
def clean_test_environment(type, cfgs, reps):
|
||||
if type == "o":
|
||||
def clean_test_environment(env_type, cfgs, reps):
|
||||
if env_type == "o":
|
||||
for i in range(1,reps):
|
||||
shutil.rmtree("data/sfcf_test/data_o/test_r"+str(i))
|
||||
shutil.rmtree("tests/data/sfcf_test/data_o/test_r"+str(i))
|
||||
for i in range(2,cfgs+1):
|
||||
shutil.rmtree("data/sfcf_test/data_o/test_r0/cfg"+str(i))
|
||||
elif type == "c":
|
||||
shutil.rmtree("tests/data/sfcf_test/data_o/test_r0/cfg"+str(i))
|
||||
elif env_type == "c":
|
||||
for i in range(1,reps):
|
||||
shutil.rmtree("data/sfcf_test/data_c/data_c_r"+str(i))
|
||||
shutil.rmtree("tests/data/sfcf_test/data_c/data_c_r"+str(i))
|
||||
for i in range(2,cfgs+1):
|
||||
os.remove("data/sfcf_test/data_c/data_c_r0/data_c_r0_n"+str(i))
|
||||
os.remove("tests/data/sfcf_test/data_c/data_c_r0/data_c_r0_n"+str(i))
|
||||
|
||||
|
||||
def test_o_bb():
|
||||
build_test_environment("o",5,3)
|
||||
f_1 = sfin.read_sfcf("data/sfcf_test/data_o", "test", "f_1",quarks="lquark lquark", wf = 0, wf2=0, version = "2.0", single = True)
|
||||
f_1 = sfin.read_sfcf("tests/data/sfcf_test/data_o", "test", "f_1",quarks="lquark lquark", wf = 0, wf2=0, version = "2.0", single = True)
|
||||
print(f_1)
|
||||
clean_test_environment("o",5,3)
|
||||
assert len(f_1) == 1
|
||||
|
@ -51,7 +50,7 @@ def test_o_bb():
|
|||
|
||||
def test_o_bi():
|
||||
build_test_environment("o",5,3)
|
||||
f_A = sfin.read_sfcf("data/sfcf_test/data_o", "test", "f_A",quarks="lquark lquark", wf = 0, version = "2.0")
|
||||
f_A = sfin.read_sfcf("tests/data/sfcf_test/data_o", "test", "f_A",quarks="lquark lquark", wf = 0, version = "2.0")
|
||||
print(f_A)
|
||||
clean_test_environment("o",5,3)
|
||||
assert len(f_A) == 3
|
||||
|
@ -61,7 +60,7 @@ def test_o_bi():
|
|||
|
||||
def test_o_bib():
|
||||
build_test_environment("o",5,3)
|
||||
f_V0 = sfin.read_sfcf("data/sfcf_test/data_o", "test", "F_V0",quarks="lquark lquark", wf = 0, wf2 = 0, version = "2.0", b2b = True)
|
||||
f_V0 = sfin.read_sfcf("tests/data/sfcf_test/data_o", "test", "F_V0",quarks="lquark lquark", wf = 0, wf2 = 0, version = "2.0", b2b = True)
|
||||
print(f_V0)
|
||||
clean_test_environment("o",5,3)
|
||||
assert len(f_V0) == 3
|
||||
|
@ -71,7 +70,7 @@ def test_o_bib():
|
|||
|
||||
def test_c_bb():
|
||||
build_test_environment("c",5,3)
|
||||
f_1 = sfin.read_sfcf("data/sfcf_test/data_c", "data_c", "f_1", quarks="lquark lquark", wf = 0, wf2=0, version = "2.0c", single = True)
|
||||
f_1 = sfin.read_sfcf("tests/data/sfcf_test/data_c", "data_c", "f_1", quarks="lquark lquark", wf = 0, wf2=0, version = "2.0c", single = True)
|
||||
print(f_1)
|
||||
clean_test_environment("c",5,3)
|
||||
assert len(f_1) == 1
|
||||
|
@ -79,7 +78,7 @@ def test_c_bb():
|
|||
|
||||
def test_c_bi():
|
||||
build_test_environment("c",5,3)
|
||||
f_A = sfin.read_sfcf("data/sfcf_test/data_c", "data_c", "f_A", quarks="lquark lquark", wf = 0, version = "2.0c")
|
||||
f_A = sfin.read_sfcf("tests/data/sfcf_test/data_c", "data_c", "f_A", quarks="lquark lquark", wf = 0, version = "2.0c")
|
||||
print(f_A)
|
||||
clean_test_environment("c",5,3)
|
||||
assert len(f_A) == 3
|
||||
|
@ -89,7 +88,7 @@ def test_c_bi():
|
|||
|
||||
def test_c_bib():
|
||||
build_test_environment("c",5,3)
|
||||
f_V0 = sfin.read_sfcf("data/sfcf_test/data_c", "data_c", "F_V0",quarks="lquark lquark", wf = 0, wf2 = 0, version = "2.0c", b2b = True)
|
||||
f_V0 = sfin.read_sfcf("tests/data/sfcf_test/data_c", "data_c", "F_V0",quarks="lquark lquark", wf = 0, wf2 = 0, version = "2.0c", b2b = True)
|
||||
print(f_V0)
|
||||
clean_test_environment("c",5,3)
|
||||
assert len(f_V0) == 3
|
||||
|
@ -99,7 +98,7 @@ def test_c_bib():
|
|||
|
||||
def test_a_bb():
|
||||
build_test_environment("a",5,3)
|
||||
f_1 = sfin.read_sfcf("data/sfcf_test/data_a", "data_a", "f_1", quarks="lquark lquark", wf = 0, wf2=0, version = "2.0a", single = True)
|
||||
f_1 = sfin.read_sfcf("tests/data/sfcf_test/data_a", "data_a", "f_1", quarks="lquark lquark", wf = 0, wf2=0, version = "2.0a", single = True)
|
||||
print(f_1)
|
||||
clean_test_environment("a",5,3)
|
||||
assert len(f_1) == 1
|
||||
|
@ -107,7 +106,7 @@ def test_a_bb():
|
|||
|
||||
def test_a_bi():
|
||||
build_test_environment("a",5,3)
|
||||
f_A = sfin.read_sfcf("data/sfcf_test/data_a", "data_a", "f_A", quarks="lquark lquark", wf = 0, version = "2.0a")
|
||||
f_A = sfin.read_sfcf("tests/data/sfcf_test/data_a", "data_a", "f_A", quarks="lquark lquark", wf = 0, version = "2.0a")
|
||||
print(f_A)
|
||||
clean_test_environment("a",5,3)
|
||||
assert len(f_A) == 3
|
||||
|
@ -117,7 +116,7 @@ def test_a_bi():
|
|||
|
||||
def test_a_bib():
|
||||
build_test_environment("a",5,3)
|
||||
f_V0 = sfin.read_sfcf("data/sfcf_test/data_a", "data_a", "F_V0",quarks="lquark lquark", wf = 0, wf2 = 0, version = "2.0a", b2b = True)
|
||||
f_V0 = sfin.read_sfcf("tests/data/sfcf_test/data_a", "data_a", "F_V0",quarks="lquark lquark", wf = 0, wf2 = 0, version = "2.0a", b2b = True)
|
||||
print(f_V0)
|
||||
clean_test_environment("a",5,3)
|
||||
assert len(f_V0) == 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue