Skip to content

Commit 3119e18

Browse files
Merge pull request #1370 from pmgbergen/ruff_on_test
Require ruff and isort on the test suite
2 parents 269d3ef + aba7458 commit 3119e18

31 files changed

+64
-80
lines changed

.github/workflows/run-static-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,17 @@ jobs:
102102
# Run the various checks
103103
- name: Ruff linting
104104
if: ${{ always() }}
105-
run: ruff check src
105+
run: ruff check src tests
106106

107107
- name: Ruff formatting
108108
if: ${{always()}}
109-
run: ruff format --check src
109+
run: ruff format --check src tests
110110

111111
# EK note to self: Ruff may introduce sorting of imports in the future, if so, we
112112
# should use that instead of isort.
113113
- name: isort
114114
if: ${{ always() }}
115-
run: isort src
115+
run: isort src tests
116116

117117
- name: mypy
118118
if: ${{ always() }}

tests/applications/md_grids/test_mdg_library.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
cause problems, we deactivate the corresponding asserts.
44
"""
55

6-
import pytest
76
import numpy as np
7+
import pytest
88

99
import porepy as pp
1010

tests/applications/test_convergence_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import porepy as pp
2222
from porepy.applications.convergence_analysis import ConvergenceAnalysis
2323
from porepy.applications.md_grids.mdg_library import (
24-
square_with_orthogonal_fractures,
2524
cube_with_orthogonal_fractures,
25+
square_with_orthogonal_fractures,
2626
)
2727
from porepy.models.fluid_mass_balance import SinglePhaseFlow
2828
from porepy.utils.txt_io import read_data_from_txt

tests/compositional/test_materials.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111

1212
from __future__ import annotations
1313

14+
from dataclasses import FrozenInstanceError
15+
1416
import numpy as np
1517
import pytest
1618

1719
import porepy as pp
18-
19-
from dataclasses import FrozenInstanceError
20-
2120
from porepy.examples.flow_benchmark_2d_case_1 import FractureSolidConstants
2221

2322

tests/functional/setups/manu_flow_comp_2d_frac.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,7 @@ def interface_flux(self, intf: pp.MortarGrid, time: number) -> np.ndarray:
567567

568568
return lmbda_cc
569569

570-
def matrix_boundary_pressure(
571-
self, bg: pp.BoundaryGrid, time: number
572-
) -> np.ndarray:
570+
def matrix_boundary_pressure(self, bg: pp.BoundaryGrid, time: number) -> np.ndarray:
573571
"""Exact pressure at the boundary faces.
574572
575573
Parameters:

tests/functional/setups/manu_poromech_nofrac_2d.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import sympy as sym
5757

5858
import porepy as pp
59-
6059
from porepy.applications.convergence_analysis import ConvergenceAnalysis
6160
from porepy.applications.md_grids.domains import nd_cube_domain
6261
from porepy.utils.examples_utils import VerificationUtils

tests/functional/test_benchmark_2d_case_3.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@
1313
1414
"""
1515

16+
from typing import Literal
17+
1618
import numpy as np
1719
import pytest
1820

1921
import porepy as pp
20-
21-
22+
from porepy.applications.test_utils.benchmarks import EffectivePermeability
2223
from porepy.examples.flow_benchmark_2d_case_3 import (
2324
FlowBenchmark2dCase3aModel,
2425
FlowBenchmark2dCase3bModel,
2526
solid_constants,
2627
)
27-
from porepy.applications.test_utils.benchmarks import EffectivePermeability
28-
from typing import Literal
2928

3029

3130
class Model3aWithEffectivePermeability(

tests/functional/test_benchmark_3d_case_3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
1414
"""
1515

16+
from typing import Literal
17+
1618
import numpy as np
1719
import pytest
1820

1921
import porepy as pp
20-
22+
from porepy.applications.test_utils.benchmarks import EffectivePermeability
2123
from porepy.examples.flow_benchmark_3d_case_3 import (
2224
FlowBenchmark3dCase3Model,
2325
solid_constants,
2426
)
25-
from porepy.applications.test_utils.benchmarks import EffectivePermeability
26-
from typing import Literal
2727

2828

2929
class ModelWithEffectivePermeability(

tests/functional/test_mandel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
import pytest
2222

2323
import porepy as pp
24-
2524
from porepy.examples.mandel_biot import (
26-
MandelSaveData,
2725
MandelModel,
26+
MandelSaveData,
2827
mandel_fluid_constants,
2928
mandel_solid_constants,
3029
)

tests/functional/test_manu_flow_comp_frac.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
from tests.functional.setups.manu_flow_comp_2d_frac import (
4848
ManuCompFlowModel2d,
4949
manu_comp_fluid,
50-
manu_comp_solid,
5150
manu_comp_ref_vals,
51+
manu_comp_solid,
5252
)
5353
from tests.functional.setups.manu_flow_comp_3d_frac import ManuCompFlowModel3d
5454

0 commit comments

Comments
 (0)