Skip to content

Commit

Permalink
Merge pull request #773 from festim-dev/fix-warning
Browse files Browse the repository at this point in the history
Fix warnings + remove warnings in test
  • Loading branch information
RemDelaporteMathurin authored Jun 3, 2024
2 parents cee0d57 + f30ba73 commit 217dc15
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ jobs:
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: myenv
mamba-version: "*"
# mamba-version: "*"
channels: conda-forge, defaults

- name: Create Conda environment
shell: bash -l {0}
run: |
# conda upgrade --strict-channel-priority -c conda-forge --all
conda install -c conda-forge 'conda-libmamba-solver<23.9'
mamba install -c conda-forge fenics
conda install -c conda-forge fenics numpy=1.24 python=3.10
- name: Install dependencies
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/userguide/export_post_processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ The data can be accessed in three different ways:
print(flux_surf_3.t)
print(flux_surf_3.data)
print(my_derived_quantities.derived_quantities[2].data)
print(my_derived_quantities[2].data)
- export and read from a .csv file:

Expand Down
2 changes: 1 addition & 1 deletion festim/generic_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def initialise(self):

for export in self.exports:
if isinstance(export, festim.DerivedQuantities):
for q in export.derived_quantities:
for q in export:
if not isinstance(q, tuple(allowed_quantities[self.mesh.type])):
warnings.warn(
f"{type(q)} may not work as intended for {self.mesh.type} meshes"
Expand Down
2 changes: 2 additions & 0 deletions test/simulation/test_postprocessing_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def test_fluxes(self, my_sim):
assert np.isclose(data[1][3], -1 * grad_T * lambda_x_0)
assert np.isclose(data[1][4], -1 * grad_T * lambda_x_1 * -1)

@pytest.mark.filterwarnings("ignore:in 1D")
def test_performance_xdmf_export_every_N_iterations(self, my_sim, tmpdir):
"""Runs run_post_processing several times with different export.mode
values and checks that the xdmf
Expand Down Expand Up @@ -215,6 +216,7 @@ def test_performance_xdmf_export_every_N_iterations(self, my_sim, tmpdir):
for t_expected, t in zip(expected_times, times):
assert t_expected == pytest.approx(float(t))

@pytest.mark.filterwarnings("ignore:in 1D")
def test_xdmf_export_only_last_timestep(self, my_sim, tmpdir):
"""Runs run_post_processing with mode="last":
- when the time is not the final time and checks that nothing has been
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from nis import match
import festim as F
import pytest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from nis import match
import festim as F
import pytest

Expand Down
2 changes: 2 additions & 0 deletions test/unit/test_exports/test_trap_density_xdmf_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sympy as sp
from pathlib import Path
import numpy as np
import pytest


def test_trap_density_xdmf_export_intergration_with_simultion(tmpdir):
Expand Down Expand Up @@ -96,6 +97,7 @@ def test_trap_density_xdmf_export_write(tmpdir):
assert error_L2 < 1e-10


@pytest.mark.filterwarnings("ignore:in 1D")
def test_trap_density_xdmf_export_traps_materials_mixed(tmpdir):
"""Integration test for TrapDensityXDMF.write() with a trap material given
as a string. Creates a festim simulation and exports the trap density as an
Expand Down
6 changes: 3 additions & 3 deletions test/unit/test_exports/test_xdmf_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def folder(tmpdir):


def test_define_file_upon_construction(folder):
mesh = f.UnitIntervalMesh(10)
mesh = f.UnitSquareMesh(8, 8)
filename = "{}/my_filename.xdmf".format(folder)
my_xdmf = XDMFExport("solute", label="solute_label", filename=filename)

Expand All @@ -30,7 +30,7 @@ def test_default_filename():


class TestDefineFile:
mesh = f.UnitIntervalMesh(10)
mesh = f.UnitSquareMesh(8, 8)
my_xdmf = XDMFExport("solute", "my_label", filename="my_filename.xdmf")

def test_file_exists(self, folder):
Expand All @@ -44,7 +44,7 @@ def test_file_exists(self, folder):


class TestWrite:
mesh = f.UnitIntervalMesh(10)
mesh = f.UnitSquareMesh(8, 8)
V = f.FunctionSpace(mesh, "P", 1)
u = f.Function(V)
label_to_function = {"solute": u}
Expand Down

0 comments on commit 217dc15

Please sign in to comment.