From 2422b435ab2b4e484703803971fa8d7184f34c34 Mon Sep 17 00:00:00 2001 From: Ivan Matveev Date: Wed, 10 Dec 2025 14:59:07 +0300 Subject: [PATCH] Fix import order in tests --- .github/workflows/ci.yml | 17 +++++++++++++++-- .pre-commit-config.yaml | 5 +++-- pyproject.toml | 2 +- tests/test_arrow_utils.py | 1 + tests/test_iceberg_loader.py | 3 ++- tests/test_partitioning.py | 3 ++- tests/test_streaming.py | 3 ++- tests/test_type_mappings.py | 3 ++- 8 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82809fa..b435f17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,22 @@ on: - cron: '0 0 * * 1' jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: "pip" + - name: Install hatch + run: pip install hatch + - name: Lint + run: hatch run lint + build: + needs: lint runs-on: ubuntu-latest strategy: matrix: @@ -24,8 +39,6 @@ jobs: cache: "pip" - name: Install hatch run: pip install hatch - - name: Lint - run: hatch run lint - name: Type check run: hatch run types:check - name: Test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2736353..32403c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,12 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.7 + rev: v0.6.9 hooks: - id: ruff - args: [--fix] + args: [--fix, "--target-version=py310"] exclude: ^examples/ - id: ruff-format + args: ["--target-version=py310"] exclude: ^examples/ - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.13.0 diff --git a/pyproject.toml b/pyproject.toml index dbfa8cc..615a79d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,7 +108,7 @@ exclude_lines = [ [tool.ruff] line-length = 120 indent-width = 4 -target-version = "py313" +target-version = "py310" [tool.ruff.lint] select = ["E", "F", "I", "UP", "B", "SIM", "N", "TID"] diff --git a/tests/test_arrow_utils.py b/tests/test_arrow_utils.py index db74421..fd0bd11 100644 --- a/tests/test_arrow_utils.py +++ b/tests/test_arrow_utils.py @@ -1,6 +1,7 @@ import unittest import pyarrow as pa + from iceberg_loader.arrow_utils import ( convert_column_type, convert_table_types, diff --git a/tests/test_iceberg_loader.py b/tests/test_iceberg_loader.py index 56dc160..e069565 100644 --- a/tests/test_iceberg_loader.py +++ b/tests/test_iceberg_loader.py @@ -3,9 +3,10 @@ from unittest.mock import MagicMock, patch import pyarrow as pa +from pyiceberg.exceptions import NoSuchTableError + from iceberg_loader.iceberg_loader import IcebergLoader, load_data_to_iceberg from iceberg_loader.settings import TABLE_PROPERTIES -from pyiceberg.exceptions import NoSuchTableError class TestIcebergLoader(unittest.TestCase): diff --git a/tests/test_partitioning.py b/tests/test_partitioning.py index 059242f..a27adf6 100644 --- a/tests/test_partitioning.py +++ b/tests/test_partitioning.py @@ -2,7 +2,6 @@ from unittest.mock import MagicMock import pyarrow as pa -from iceberg_loader.schema import SchemaManager from pyiceberg.partitioning import PartitionSpec from pyiceberg.transforms import ( BucketTransform, @@ -13,6 +12,8 @@ YearTransform, ) +from iceberg_loader.schema import SchemaManager + class TestSchemaManagerPartitioning(unittest.TestCase): def setUp(self): diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 2baa8ad..9224469 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -3,9 +3,10 @@ from unittest.mock import MagicMock import pyarrow as pa -from iceberg_loader import IcebergLoader from pyiceberg.exceptions import NoSuchTableError +from iceberg_loader import IcebergLoader + class TestStreaming(unittest.TestCase): def test_load_ipc_stream(self): diff --git a/tests/test_type_mappings.py b/tests/test_type_mappings.py index 9c81af4..3aceeab 100644 --- a/tests/test_type_mappings.py +++ b/tests/test_type_mappings.py @@ -1,9 +1,10 @@ import unittest import pyarrow as pa -from iceberg_loader.type_mappings import get_arrow_type, get_iceberg_type, register_custom_mapping from pyiceberg.types import IntegerType, LongType, StringType, TimestampType, TimestamptzType +from iceberg_loader.type_mappings import get_arrow_type, get_iceberg_type, register_custom_mapping + class TestTypeMappings(unittest.TestCase): def test_arrow_to_iceberg_basic(self):