Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added tests/main/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions tests/main/driver/test_driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest.mock
from datetime import datetime, timedelta
from typing import Literal, Tuple
from typing import Literal

import pytest

Expand All @@ -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",
Expand Down
13 changes: 6 additions & 7 deletions tests/main/driver/test_example_configs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
from pathlib import Path
from typing import List

import pytest
import yaml
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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))
Expand Down
Empty file added tests/main/fv3core/__init__.py
Empty file.
3 changes: 1 addition & 2 deletions tests/main/fv3core/test_dycore_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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),
Expand Down
6 changes: 0 additions & 6 deletions tests/main/fv3core/test_init_from_geos.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import f90nml
import numpy as np
import pytest # noqa

from ndsl.config import Backend
from pace import NullComm
Expand Down Expand Up @@ -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,
Expand Down
Empty file added tests/main/physics/__init__.py
Empty file.
Empty file added tests/mpi/__init__.py
Empty file.
Empty file added tests/mpi/ext_grid/__init__.py
Empty file.
Empty file added tests/mpi/restart/__init__.py
Empty file.
Empty file added tests/savepoint/__init__.py
Empty file.
10 changes: 4 additions & 6 deletions tests/savepoint/test_checkpoints.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dataclasses
from datetime import timedelta
from pathlib import Path
from typing import List, Tuple

import dacite
import f90nml
Expand All @@ -14,7 +13,6 @@
CubedSpherePartitioner,
GridIndexing,
MPIComm,
Namelist,
Quantity,
QuantityFactory,
StencilConfig,
Expand All @@ -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(
Expand All @@ -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
Expand All @@ -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(),
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion tests/savepoint/translate/translate_driver.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down