From 6f5717e28a877d0c7cc9c077cbd59777952fc60c Mon Sep 17 00:00:00 2001 From: Ariel Schulz Date: Tue, 10 Feb 2026 16:49:18 +0100 Subject: [PATCH] Remove deprecation warning for projects to switch over to BaseConfig --- doc/changes/unreleased.md | 4 ++++ exasol/toolbox/nox/_artifacts.py | 2 -- exasol/toolbox/nox/_ci.py | 3 --- exasol/toolbox/nox/_format.py | 2 -- exasol/toolbox/nox/_release.py | 2 -- exasol/toolbox/nox/_shared.py | 13 ---------- test/unit/nox/_shared_test.py | 41 -------------------------------- 7 files changed, 4 insertions(+), 63 deletions(-) diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index f5db04f32..d77d8d526 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -5,3 +5,7 @@ ## Feature * #691: Started customization of PTB workflows by defining the YML schema + +## Refactoring + +* #664: Removed deprecation warning for projects to switch over to BaseConfig diff --git a/exasol/toolbox/nox/_artifacts.py b/exasol/toolbox/nox/_artifacts.py index b4e933743..e72324383 100644 --- a/exasol/toolbox/nox/_artifacts.py +++ b/exasol/toolbox/nox/_artifacts.py @@ -12,7 +12,6 @@ from nox import Session from exasol.toolbox.config import BaseConfig -from exasol.toolbox.nox._shared import check_for_config_attribute from noxconfig import PROJECT_CONFIG COVERAGE_DB = ".coverage" @@ -156,7 +155,6 @@ def copy_artifacts(session: Session) -> None: def _python_version_suffix() -> str: - check_for_config_attribute(PROJECT_CONFIG, "minimum_python_version") pivot = PROJECT_CONFIG.minimum_python_version return f"-python{pivot}" diff --git a/exasol/toolbox/nox/_ci.py b/exasol/toolbox/nox/_ci.py index da2f9d22d..ff3f047dc 100644 --- a/exasol/toolbox/nox/_ci.py +++ b/exasol/toolbox/nox/_ci.py @@ -5,7 +5,6 @@ from nox import Session from exasol.toolbox.config import BaseConfig -from exasol.toolbox.nox._shared import check_for_config_attribute from noxconfig import ( PROJECT_CONFIG, ) @@ -14,12 +13,10 @@ def _python_matrix(config: BaseConfig): - check_for_config_attribute(config=config, attribute="python_versions") return {"python-version": config.python_versions} def _exasol_matrix(config: BaseConfig): - check_for_config_attribute(config=config, attribute="exasol_versions") return {"exasol-version": config.exasol_versions} diff --git a/exasol/toolbox/nox/_format.py b/exasol/toolbox/nox/_format.py index 94072f6dc..e05eaf2d8 100644 --- a/exasol/toolbox/nox/_format.py +++ b/exasol/toolbox/nox/_format.py @@ -9,7 +9,6 @@ from exasol.toolbox.nox._shared import ( Mode, _version, - check_for_config_attribute, get_filtered_python_files, ) from noxconfig import ( @@ -26,7 +25,6 @@ def command(*args: str) -> Iterable[str]: def _pyupgrade(session: Session, config: BaseConfig, files: Iterable[str]) -> None: - check_for_config_attribute(config, "pyupgrade_argument") session.run( "pyupgrade", *config.pyupgrade_argument, diff --git a/exasol/toolbox/nox/_release.py b/exasol/toolbox/nox/_release.py index ff1ea16a9..e93cf41a6 100644 --- a/exasol/toolbox/nox/_release.py +++ b/exasol/toolbox/nox/_release.py @@ -11,7 +11,6 @@ from exasol.toolbox.nox._shared import ( Mode, _version, - check_for_config_attribute, ) from exasol.toolbox.nox.plugin import NoxTasks from exasol.toolbox.util.dependencies.shared_models import PoetryFiles @@ -103,7 +102,6 @@ def run(*args: str): run("git", "tag", str(release_version)) run("git", "push", "origin", str(release_version)) - check_for_config_attribute(project_config, "create_major_version_tags") if project_config.create_major_version_tags: major_release_version = f"v{release_version.major}" run("git", "tag", "-f", str(major_release_version)) diff --git a/exasol/toolbox/nox/_shared.py b/exasol/toolbox/nox/_shared.py index 6c05d9349..3b51d604d 100644 --- a/exasol/toolbox/nox/_shared.py +++ b/exasol/toolbox/nox/_shared.py @@ -14,7 +14,6 @@ from nox import Session -from exasol.toolbox.config import BaseConfig from noxconfig import ( PROJECT_CONFIG, ) @@ -22,17 +21,6 @@ DOCS_OUTPUT_DIR = ".html-documentation" -def check_for_config_attribute(config: BaseConfig, attribute: str): - if not hasattr(config, attribute): - raise AttributeError( - "in the noxconfig.py file, the class Config should inherit " - "from `exasol.toolbox.config.BaseConfig`. This is used to " - f"set the default `{attribute}`. If the allowed " - f"`{attribute} needs to differ in your project and is an " - "input parameter (not property), you can set it in the PROJECT_CONFIG statement." - ) - - class Mode(Enum): Fix = auto() Check = auto() @@ -42,7 +30,6 @@ def get_filtered_python_files(project_root: Path) -> list[str]: """ Returns iterable of Python files after removing excluded paths """ - check_for_config_attribute(config=PROJECT_CONFIG, attribute="excluded_python_paths") files = project_root.glob("**/*.py") return [ f"{path}" diff --git a/test/unit/nox/_shared_test.py b/test/unit/nox/_shared_test.py index 2b31e8451..18308a54f 100644 --- a/test/unit/nox/_shared_test.py +++ b/test/unit/nox/_shared_test.py @@ -1,13 +1,8 @@ -from collections.abc import Iterable -from dataclasses import dataclass -from pathlib import Path from unittest.mock import patch import pytest -from exasol.toolbox.config import BaseConfig from exasol.toolbox.nox._shared import ( - check_for_config_attribute, get_filtered_python_files, ) @@ -64,39 +59,3 @@ def test_get_filtered_python_files( assert len(actual) == 1 assert "toolbox-dummy" in actual[0] - - -@dataclass(frozen=True) -class PreviousConfig: - root: Path = Path(__file__).parent - doc: Path = Path(__file__).parent / "doc" - source: Path = Path("exasol/toolbox") - version_file: Path = Path(__file__).parent / "exasol" / "toolbox" / "version.py" - path_filters: Iterable[str] = () - pyupgrade_args: Iterable[str] = ("--py310-plus",) - plugins = [] - - -# attributes + properties -MIGRATED_VALUES = [ - *BaseConfig.model_fields.keys(), - *BaseConfig.model_computed_fields.keys(), -] - - -class TestCheckForConfigAttribute: - - @pytest.mark.parametrize("attribute", MIGRATED_VALUES) - def test_old_implementation_raises_error(self, attribute): - with pytest.raises( - AttributeError, match="from `exasol.toolbox.config.BaseConfig`" - ): - check_for_config_attribute(PreviousConfig(), attribute=attribute) - - @pytest.mark.parametrize("attribute", MIGRATED_VALUES) - def test_current_implementation_passes( - self, test_project_config_factory, attribute - ): - check_for_config_attribute( - config=test_project_config_factory(), attribute=attribute - )