From e871ce29e7524d02b2cf7ac1c6c95b2cf540bb9c Mon Sep 17 00:00:00 2001 From: w-bonelli Date: Mon, 11 Sep 2023 17:32:34 -0400 Subject: [PATCH] fix: support Python 3.8 --- common/DisvPropertyContainer.py | 7 ++++--- etc/conftest.py | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/common/DisvPropertyContainer.py b/common/DisvPropertyContainer.py index f4d28af2..5072e2c0 100644 --- a/common/DisvPropertyContainer.py +++ b/common/DisvPropertyContainer.py @@ -1,5 +1,6 @@ import copy from itertools import cycle +from typing import List import matplotlib.pyplot as plt import numpy as np @@ -103,10 +104,10 @@ class DisvPropertyContainer: nlay: int ncpl: int nvert: int - vertices: list[list] # [[iv, xv, yv], ...] - cell2d: list[list] # [[ic, xc, yc, ncvert, icvert], ...] + vertices: List[list] # [[iv, xv, yv], ...] + cell2d: List[list] # [[ic, xc, yc, ncvert, icvert], ...] top: np.ndarray - botm: list[np.ndarray] + botm: List[np.ndarray] origin_x: float origin_y: float rotation: float diff --git a/etc/conftest.py b/etc/conftest.py index 81ad6383..589285d1 100644 --- a/etc/conftest.py +++ b/etc/conftest.py @@ -1,4 +1,4 @@ -import os +from pathlib import Path def pytest_addoption(parser): @@ -8,9 +8,11 @@ def pytest_addoption(parser): def pytest_generate_tests(metafunc): if "build" in metafunc.fixturenames: run = metafunc.config.getoption("run") + path = Path.cwd().parent / "scripts" + files = sorted(list(path.glob("ex-*.py"))) scripts_dict = { - file_name: (run, file_name) - for file_name in sorted(os.listdir(os.path.join("..", "scripts"))) - if file_name.endswith(".py") and file_name.startswith("ex-") + file: (run, file) + for file in files + if file.name.endswith(".py") and file.name.startswith("ex-") } metafunc.parametrize("build", scripts_dict.values(), ids=scripts_dict.keys())