diff --git a/tests/main/__init__.py b/tests/main/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/main/driver/test_driver.py b/tests/main/driver/test_driver.py index c48b6510..6e3f08e8 100644 --- a/tests/main/driver/test_driver.py +++ b/tests/main/driver/test_driver.py @@ -1,6 +1,6 @@ import unittest.mock from datetime import datetime, timedelta -from typing import Literal, Tuple +from typing import Literal import pytest @@ -22,7 +22,7 @@ def get_driver_config( hours: int = 0, minutes: int = 0, seconds: int = 0, - layout: Tuple[int, int] = (1, 1), + layout: tuple[int, int] = (1, 1), frequency: int = 1, output_initial_state=False, start_time_type: Literal["timedelta", "datetime"] = "timedelta", diff --git a/tests/main/driver/test_example_configs.py b/tests/main/driver/test_example_configs.py index f8e77c83..e16ce84c 100644 --- a/tests/main/driver/test_example_configs.py +++ b/tests/main/driver/test_example_configs.py @@ -1,6 +1,5 @@ import os from pathlib import Path -from typing import List import pytest import yaml @@ -9,7 +8,7 @@ from tests.paths import EXAMPLE_CONFIGS_DIR, JENKINS_CONFIGS_DIR -TESTED_CONFIGS: List[str] = [ +TESTED_CONFIGS: list[str] = [ "baroclinic_c12.yaml", "baroclinic_c12_dp.yaml", "baroclinic_c12_explicit_physics.yaml", @@ -20,7 +19,7 @@ "baroclinic_c48_6ranks_serialbox_test.yaml", "analytic_test.yaml", ] -EXCLUDED_CONFIGS: List[str] = [ +EXCLUDED_CONFIGS: list[str] = [ # We don't test serialbox example because it loads namelist # filepath that are not in git "baroclinic_c12_from_serialbox.yaml", @@ -33,13 +32,13 @@ ] -TESTED_JENKINS_CONFIGS: List[str] = [ +TESTED_JENKINS_CONFIGS: list[str] = [ "baroclinic_c48_6ranks_dycore_only.yaml", "baroclinic_c192_6ranks.yaml", "baroclinic_c192_54ranks.yaml", ] -EXCLUDED_JENKINS_CONFIGS: List[str] = [ +EXCLUDED_JENKINS_CONFIGS: list[str] = [ # We don't test serialbox example because it loads namelist # filepath that are not in git "baroclinic_c48_6ranks_dycore_only_serialbox.yaml", @@ -61,7 +60,7 @@ ], ) def test_all_configs_tested_or_excluded( - config_dir: Path, tested_configs: List[str], excluded_configs: List[str] + config_dir: Path, tested_configs: list[str], excluded_configs: list[str] ): """ If any configs are not tested or excluded, add them to TESTED_CONFIGS or @@ -84,7 +83,7 @@ def test_all_configs_tested_or_excluded( pytest.param(JENKINS_CONFIGS_DIR, TESTED_JENKINS_CONFIGS), ], ) -def test_example_config_can_initialize(path: Path, file_list: List[str]): +def test_example_config_can_initialize(path: Path, file_list: list[str]): for file_name in file_list: with open(path / file_name, "r") as f: config = DriverConfig.from_dict(yaml.safe_load(f)) diff --git a/tests/main/fv3core/__init__.py b/tests/main/fv3core/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/main/fv3core/test_dycore_call.py b/tests/main/fv3core/test_dycore_call.py index 7cc9552f..43262c84 100644 --- a/tests/main/fv3core/test_dycore_call.py +++ b/tests/main/fv3core/test_dycore_call.py @@ -2,7 +2,6 @@ from dataclasses import fields from datetime import timedelta from pathlib import Path -from typing import Tuple import pyfv3.initialization.analytic_init as ai from ndsl import ( @@ -27,7 +26,7 @@ from pyfv3.initialization.analytic_init import AnalyticCase -def setup_dycore() -> Tuple[DynamicalCore, DycoreState, Timer]: +def setup_dycore() -> tuple[DynamicalCore, DycoreState, Timer]: backend = Backend("st:numpy:cpu:IJK") config = DynamicalCoreConfig( layout=(1, 1), diff --git a/tests/main/fv3core/test_init_from_geos.py b/tests/main/fv3core/test_init_from_geos.py index 3947ddd9..4b24c578 100644 --- a/tests/main/fv3core/test_init_from_geos.py +++ b/tests/main/fv3core/test_init_from_geos.py @@ -1,6 +1,5 @@ import f90nml import numpy as np -import pytest # noqa from ndsl.config import Backend from pace import NullComm @@ -108,11 +107,6 @@ def test_geos_wrapper(): namelist["nx_tile"] + 2 * nhalo + 1, namelist["nz"], ) - shape_z_interface = ( - namelist["nx_tile"] + 2 * nhalo, - namelist["nx_tile"] + 2 * nhalo, - namelist["nz"] + 1, - ) shape2d = ( namelist["nx_tile"] + 2 * nhalo, namelist["nx_tile"] + 2 * nhalo, diff --git a/tests/main/physics/__init__.py b/tests/main/physics/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/mpi/__init__.py b/tests/mpi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/mpi/ext_grid/__init__.py b/tests/mpi/ext_grid/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/mpi/restart/__init__.py b/tests/mpi/restart/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/savepoint/__init__.py b/tests/savepoint/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/savepoint/test_checkpoints.py b/tests/savepoint/test_checkpoints.py index 2a80abd3..316c4205 100644 --- a/tests/savepoint/test_checkpoints.py +++ b/tests/savepoint/test_checkpoints.py @@ -1,7 +1,6 @@ import dataclasses from datetime import timedelta from pathlib import Path -from typing import List, Tuple import dacite import f90nml @@ -14,7 +13,6 @@ CubedSpherePartitioner, GridIndexing, MPIComm, - Namelist, Quantity, QuantityFactory, StencilConfig, @@ -37,7 +35,7 @@ def get_grid( - data_path: Path, rank: int, layout: Tuple[int, int], backend: Backend + data_path: Path, rank: int, layout: tuple[int, int], backend: Backend ) -> Grid: ds_grid: xr.Dataset = xr.open_dataset(data_path / "Grid-Info.nc").isel(savepoint=0) grid = TranslateGrid( @@ -58,7 +56,7 @@ def __init__( self._ds = ds self._translate = translate - def new_state(self) -> Tuple[DycoreState, GridData]: + def new_state(self) -> tuple[DycoreState, GridData]: input_data = dataset_to_dict(self._ds.copy()) state, grid_data = self._translate.prepare_data(input_data) return state, grid_data @@ -68,7 +66,7 @@ def test_fv_dynamics( backend: str, data_path: Path, calibrate_thresholds: bool, threshold_path: Path ): print("start test call") - namelist = Namelist.from_f90nml(f90nml.read(data_path / "input.nml")) + namelist = f90nml.read(data_path / "input.nml") threshold_filename = threshold_path / "fv_dynamics.yaml" communicator = CubedSphereCommunicator( comm=MPIComm(), @@ -202,7 +200,7 @@ def set_manual_thresholds(thresholds: SavepointThresholds): entry[name] = Threshold(relative=0.0, absolute=0.0) -def merge_thresholds(all_thresholds: List[SavepointThresholds]): +def merge_thresholds(all_thresholds: list[SavepointThresholds]): thresholds = all_thresholds[0] for other_thresholds in all_thresholds[1:]: for savepoint_name in thresholds.savepoints: diff --git a/tests/savepoint/translate/translate_driver.py b/tests/savepoint/translate/translate_driver.py index 59016e91..4c85368e 100644 --- a/tests/savepoint/translate/translate_driver.py +++ b/tests/savepoint/translate/translate_driver.py @@ -1,4 +1,6 @@ -from ndsl import Namelist, QuantityFactory, SubtileGridSizer +from f90nml import Namelist + +from ndsl import QuantityFactory, SubtileGridSizer from ndsl.constants import N_HALO_DEFAULT from pace import Driver, DriverConfig, TendencyState from pyfv3 import DynamicalCoreConfig