diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index fb420d8c..1b164db1 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -14,7 +14,7 @@ jobs: name: Setup and install Ard strategy: matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -51,7 +51,7 @@ jobs: needs: setup-install strategy: matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -91,7 +91,7 @@ jobs: needs: test-unit strategy: matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -154,7 +154,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -235,7 +235,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest diff --git a/ard/api/interface.py b/ard/api/interface.py index 73ec9032..22ac5792 100644 --- a/ard/api/interface.py +++ b/ard/api/interface.py @@ -165,10 +165,10 @@ def set_up_system_recursive( # Add subsystems directly from the input dictionary if hasattr(parent_group, "name") and (parent_group.name != ""): print( - f"{''.join(['\t' for _ in range(_depth)])}Adding {system_name} to {parent_group.name}." + f"{''.join(' ' * 4 * _depth)}Adding {system_name} to {parent_group.name}." ) else: - print(f"{''.join(['\t' for _ in range(_depth)])}Adding {system_name}.") + print(f"{''.join(' ' * 4 * _depth)}Adding {system_name}.") if "systems" in input_dict: # Recursively add nested subsystems] if _depth > 0: group = parent_group.add_subsystem( @@ -188,7 +188,8 @@ def set_up_system_recursive( _depth=_depth + 1, ) if "approx_totals" in input_dict: - print(f"\tActivating approximate totals on {system_name}") + prefix = "\t" + print(prefix + f"Activating approximate totals on {system_name}") group.approx_totals(**input_dict["approx_totals"]) else: diff --git a/ard/collection/optiwindnet_wrap.py b/ard/collection/optiwindnet_wrap.py index fad464a1..18d525ac 100644 --- a/ard/collection/optiwindnet_wrap.py +++ b/ard/collection/optiwindnet_wrap.py @@ -43,7 +43,7 @@ def _own_L_from_inputs(inputs: dict, discrete_inputs: dict) -> nx.Graph: ) if np.any(repeat_accumulate > 0): # only if there are any repeats warn_string = ( - f"\nDetected {np.sum(repeat_accumulate > 0)} coincident " + f"Detected {np.sum(repeat_accumulate > 0)} coincident " f"turbines and/or substations in optiwindnet setup." ) # start a warning string for the UserWarning # TODO: make Ard warnings? @@ -57,11 +57,17 @@ def _own_L_from_inputs(inputs: dict, discrete_inputs: dict) -> nx.Graph: for idx, dxy in enumerate(adjustments[:T, :]): if np.sum(dxy != 0) == 0: continue - warn_string += f"\n\tadjusting turbine #{idx} from {VertexCTR[idx, :]} to {VertexCTR[idx, :] + dxy}" + warn_string += ( + "\n\t" + + f"adjusting turbine #{idx} from {VertexCTR[idx, :]} to {VertexCTR[idx, :] + dxy}" + ) for idx, dxy in enumerate((adjustments[-R:, :])[::-1, :]): if np.sum(dxy != 0) == 0: continue - warn_string += f"\n\tadjusting substation #{idx} from {VertexCTR[-(idx+1), :]} to {VertexCTR[-(idx+1), :] + dxy}" + warn_string += ( + "\n\t" + + f"adjusting substation #{idx} from {VertexCTR[-(idx+1), :]} to {VertexCTR[-(idx+1), :] + dxy}" + ) # output the final warning warn(warn_string) diff --git a/ard/utils/logging.py b/ard/utils/logging.py index 9d6a0da0..636c7049 100644 --- a/ard/utils/logging.py +++ b/ard/utils/logging.py @@ -198,7 +198,8 @@ def wrapper(*args, **kwargs): output = sys.stdout.getvalue() sys.stdout = old_stdout - tabset = "".join(["\t" for t in range(tabs)]) + prefix = "\t" + tabset = "".join([prefix for t in range(tabs)]) if output: for line in output.splitlines(): print(f"{tabset}{line}") diff --git a/ard/utils/test_utils.py b/ard/utils/test_utils.py index 058d9280..57178066 100644 --- a/ard/utils/test_utils.py +++ b/ard/utils/test_utils.py @@ -48,11 +48,13 @@ def pyrite_validator( if not validation_matches: print(f"for variable {k}:", file=sys.stderr) + prefix = "\t" print( - f"\t{sum_isclose} values match of {vd_size} total validation values", + prefix + + f"{sum_isclose} values match of {vd_size} total validation values", file=sys.stderr, ) - print(f"\tto a tolerance of {rtol_val:e}", file=sys.stderr) + print(prefix + f"to a tolerance of {rtol_val:e}", file=sys.stderr) print(f"pyrite data for {k}: {v}", file=sys.stderr) print( f"computed data for {k}: {data_for_validation[k]}", file=sys.stderr diff --git a/test/conftest.py b/test/conftest.py index 9114d9a2..80f5bd4f 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,3 +1,4 @@ +import os from pathlib import Path @@ -6,9 +7,10 @@ def pytest_sessionfinish(session, exitstatus): # for each tempdir for pytest_out_dir in Path().glob("pytest*_out"): - for root, dirs, files in pytest_out_dir.walk( - top_down=False + for root, dirs, files in os.walk( + pytest_out_dir, topdown=False ): # walk the directory + root = Path(root) for name in files: (root / name).unlink() # remove subdirectory files, and for name in dirs: