Skip to content

Commit

Permalink
Adds logging to tests failing on CloudBurst
Browse files Browse the repository at this point in the history
  • Loading branch information
mspelman07 committed Aug 12, 2024
1 parent 8daf335 commit 13446bd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
add_coordinate,
set_up_variable_cube,
)

from logging import debug

class Test_make_percentile_cube(IrisTest):

Expand Down Expand Up @@ -299,6 +299,7 @@ def test_single_point_on_corner(self):
result = GeneratePercentilesFromANeighbourhood(
2000, percentiles=percentiles
).pad_and_unpad_cube(self.cube, kernel)
debug(result.data)
self.assertArrayAlmostEqual(result.data, expected)


Expand Down Expand Up @@ -558,6 +559,7 @@ def test_single_point_low_percentiles(self):
result = GeneratePercentilesFromANeighbourhood(
radius, percentiles=percentiles
).process(self.cube)
debug(result.data)
self.assertArrayAlmostEqual(result.data, expected)

def test_point_pair(self):
Expand Down Expand Up @@ -660,6 +662,7 @@ def test_number_of_percentiles_equals_number_of_points(self):
result = GeneratePercentilesFromANeighbourhood(
radius, percentiles=percentiles
).process(cube)
debug(result.data)
self.assertArrayAlmostEqual(result.data, expected)

def test_number_of_points_half_of_number_of_percentiles(self):
Expand Down Expand Up @@ -769,6 +772,7 @@ def test_number_of_points_half_of_number_of_percentiles(self):
result = GeneratePercentilesFromANeighbourhood(
radius, percentiles=percentiles
).process(cube)
debug(result.data)
self.assertArrayAlmostEqual(result.data, expected)

def test_circle_bigger_than_domain(self):
Expand Down
6 changes: 3 additions & 3 deletions improver_tests/regrid/test_RegridWithLandSeaMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from improver.regrid.landsea import RegridLandSea
from improver.synthetic_data.set_up_test_cubes import set_up_variable_cube
from improver.utilities.pad_spatial import pad_cube_with_halo

from logging import debug

def modify_cube_coordinate_value(cube, coord_x, coord_y):
"""modify x(longitude) & y(latitude) andcoordinates for a cube"""
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_regrid_nearest_with_mask_2():
np.testing.assert_allclose(
regrid_nearest_with_mask.data, expected_results, atol=1e-3
)

debug(regrid_nearest_with_mask.data)
# consider constant field
cube_in.data = np.repeat(1.0, 20).reshape(4, 5).astype(np.float32)
regrid_nearest_with_mask = RegridLandSea(
Expand Down Expand Up @@ -260,7 +260,7 @@ def test_regrid_bilinear_with_mask_2():
np.testing.assert_allclose(
regrid_bilinear_with_mask.data, expected_results, atol=1e-3
)

debug(regrid_bilinear_with_mask.data)
# consider constant field
cube_in.data = np.repeat(1.0, 20).reshape(4, 5).astype(np.float32)
regrid_bilinear_with_mask = RegridLandSea(
Expand Down
6 changes: 3 additions & 3 deletions improver_tests/spotdata/test_NeighbourSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from improver.metadata.utilities import create_coordinate_hash
from improver.spotdata.neighbour_finding import NeighbourSelection

from logging import debug

class Test_NeighbourSelection(IrisTest):

Expand Down Expand Up @@ -870,7 +870,7 @@ def test_global_tied_case_nearest(self):
self.global_sites, self.global_orography, self.global_land_mask
)
expected = [[[2], [4], [2]]]

debug(result.data)
self.assertArrayEqual(result.data, expected)

def test_global_tied_case_nearest_land(self):
Expand Down Expand Up @@ -909,7 +909,7 @@ def test_global_tied_case_nearest_land_min_dz(self):
self.global_sites, self.global_orography, self.global_land_mask
)
expected = [[[4], [4], [0]]]

debug(result.data)
self.assertArrayEqual(result.data, expected)


Expand Down
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ markers =
slow: mark tests as slow (eg. typically more than 5 seconds)
acc: mark tests as whole plugin level acceptance tests
testpaths = improver_tests
log_file_mode = a+
log_file_format = %(asctime)s %(filename)s->%(funcName)s:%(lineno)s %(levelname)s: %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
log_file=/home/h04/mspelman/improver/pytest_log.log
log_cli_level=DEBUG

0 comments on commit 13446bd

Please sign in to comment.