Commit 91066980 authored by Baptiste Durand's avatar Baptiste Durand

Test layout, uniform imports of ho_homog

https://docs.pytest.org/en/reorganize-docs/goodpractices.html
parent bc34068e
dolfin~=2019.1.0
gmsh~=4.6.0.post3
meshio~=4.3.1
h5py~=3.1.0
matplotlib~=3.3.3
numpy~=1.19.4
sympy~=1.1.1
pytest~=6.2.1
setuptools~=39.0.1
......@@ -6,7 +6,9 @@ Created on 21/03/2019
sources : http://sametmax.com/vive-setup-cfg-et-mort-a-pyproject-toml/,
http://sametmax.com/creer-un-setup-py-et-mettre-sa-bibliotheque-python-en-ligne-sur-pypi/
https://docs.pytest.org/en/stable/goodpractices.html
"""
from setuptools import setup
setup()
\ No newline at end of file
setup()
# coding: utf8
"""
Created on 12/07/2019
@author: baptiste
Give the individual tests import contex.
Source : https://docs.python-guide.org/writing/structure/#structure-of-the-repository
"""
import site
from pathlib import Path
cur_dir = Path(__file__).resolve().parent
repository_dir = cur_dir.parent
site.addsitedir(repository_dir)
import ho_homog
This source diff could not be displayed because it is too large. You can view the blob instead.
# coding: utf8
"""
Created on 12/07/2019
@author: baptiste
Give the individual tests import contex.
Source : https://docs.python-guide.org/writing/structure/#structure-of-the-repository
"""
import site
from pathlib import Path
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
# cur_dir = Path(__file__).resolve().parent
# repository_dir = cur_dir.parent
# site.addsitedir(repository_dir)
import ho_homog
......@@ -6,7 +6,7 @@ Created on 08/04/2019
import logging
import dolfin as fe
from context.ho_homog import full_scale_pb as homog_full
from ho_homog import full_scale_pb as fsp
from pathlib import Path
from pytest import approx
......@@ -71,7 +71,7 @@ def test_reconstruction_vectors():
strain_fspace,
),
}
reconstr_sol = homog_full.reconstruction(
reconstr_sol = fsp.reconstruction(
localization_tensors, macro_fields, function_spaces, trunc_order=1
)
results_file_path = Path(__file__).with_name("test_reconstruction.xdmf")
......@@ -164,7 +164,7 @@ def test_reconstruction_with_constraint():
fe.Expression("0.5*x[0] + x[1] + 0.5*x[1] + 1.*x[0]", degree=2), scalar_fspace
)
reconstr_sol = homog_full.reconstruction(
reconstr_sol = fsp.reconstruction(
localization_tensors,
macro_fields,
function_spaces,
......@@ -239,7 +239,7 @@ def test_select_solver():
fe.Expression("0.5*x[0] + x[1] + 0.5*x[1] + 1.*x[0]", degree=2), scalar_fspace
)
reconstr_sol = homog_full.reconstruction(
reconstr_sol = fsp.reconstruction(
localization_tensors,
macro_fields,
function_spaces,
......
......@@ -5,18 +5,17 @@ Created on Mon Oct 15 11:00:18 2018
@author: Baptiste
"""
import os
from .context import ho_homog
import math
import numpy as np
import matplotlib.pyplot as plt
import copy
import logging
import math
import os
from logging.handlers import RotatingFileHandler
import gmsh
import matplotlib.pyplot as plt
import numpy as np
geo = ho_homog.geometry
import ho_homog.geometry as geo
# nice shortcuts
model = gmsh.model
......
......@@ -5,14 +5,16 @@ Created on 09/01/2019
"""
import numpy as np
import gmsh
import meshio
from ho_homog import geometry, homog2d, materials, mesh_generate_2D, part
from pytest import approx
import logging
import time
import dolfin as fe
import gmsh
import meshio
import numpy as np
from pytest import approx
from ho_homog import geometry, homog2d, materials, mesh_generate, part
logger = logging.getLogger("Test_homog2d")
logger.setLevel(logging.DEBUG)
......
......@@ -8,8 +8,8 @@ Created on 22/10/2018
import os
import gmsh
import geometry as geo
import mesh_tools as msh
from ho_homog import geometry as geo
from ho_homog import mesh_tools as msh
import numpy as np
import random
import matplotlib.pyplot as plt
......
......@@ -5,22 +5,20 @@ Created on 09/01/2019
"""
import logging
from logging.handlers import RotatingFileHandler
from pathlib import Path
from subprocess import run
import dolfin as fe
import gmsh
import numpy as np
import ho_homog
import mshr
import numpy as np
from pytest import approx
geo = ho_homog.geometry
part = ho_homog.part
mesh_2D = ho_homog.mesh_generate_2D
mat = ho_homog.materials
from ho_homog import geometry as geo
from ho_homog import materials as mat
from ho_homog import mesh_generate as mg
from ho_homog import mesh_tools
from ho_homog import part
model = gmsh.model
factory = model.occ
......@@ -40,13 +38,17 @@ if __name__ == "__main__":
stream_handler.setFormatter(formatter)
logger_root.addHandler(stream_handler)
ho_homog.geometry.init_geo_tools()
geo.init_geo_tools()
geo.set_gmsh_option("General.Verbosity", 3)
#? Test du constructeur gmsh_2_Fenics_2DRVE
# a = 1
# b, k = a, a/3
# panto_test = prt.Gmsh2DRVE.pantograph(a, b, k, 0.1, nb_cells=(2, 3), soft_mat=False, name='panto_test')
# panto_test.main_mesh_refinement((0.1,0.5),(0.03,0.3),False)
# ? Test du constructeur gmsh_2_Fenics_2DRVE
def test_rve_from_gmsh2drve():
a = 1
b, k = a, a / 3
panto_test = mg.pantograph.pantograph_RVE(
a, b, k, 0.1, nb_cells=(2, 3), soft_mat=False, name="panto_test"
)
panto_test.main_mesh_refinement((0.1, 0.5), (0.03, 0.3), False)
# panto_test.mesh_generate()
# run(f"gmsh {panto_test.name}.msh &",shell=True, check=True)
......
......@@ -8,7 +8,7 @@ import logging
import gmsh
from context import ho_homog
import ho_homog
geo = ho_homog.geometry
mesh_gen = ho_homog.mesh_generate
......
......@@ -5,7 +5,7 @@ Created on 03/05/2019
"""
import dolfin as fe
import ho_homog.toolbox_FEniCS as tb
from ho_homog import toolbox_FEniCS as tb
from pytest import approx
fe.set_log_level(30)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment