Skip to content

Conversation

@asnare
Copy link
Contributor

@asnare asnare commented Dec 30, 2025

Changes

What does this PR do?

This PR eliminates the use of Path(__file__) to locate file-based resources. In general:

  • In the main code, this is buggy: modern Python should use importlib.resources instead.
  • In tests, it's brittle and difficult to read because it's normally based on relative paths and traversal of many parent directories. It's also unnecessary, because pytest provides a mechanism for locating the project root. (Tests can also use importlib.resources, and probably should, but that's a bigger refactoring: this is a first step.)

Some incidental changes that are introduced:

  • Type hints in a few places.
  • Functional tests against Snowflake, Oracle and Presto have been consolidated into a single module. (The Snowflake functional tests have been moved into test_snowflake.py: test_databricks.py was misleading.)
  • The PipelineConfig (and Step) classes have been made immutable. (An unnecessary __post__init() method has also been eliminated.)

Tests

  • existing unit tests
  • existing integration tests

@asnare asnare self-assigned this Dec 30, 2025
@asnare asnare added tech debt design flaws and other cascading effects internal technical pr's not end user facing labels Dec 30, 2025
@github-actions
Copy link

github-actions bot commented Dec 30, 2025

✅ 129/129 passed, 7 flaky, 5 skipped, 19m12s total

Flaky tests:

  • 🤪 test_installs_and_runs_local_bladebridge (20.364s)
  • 🤪 test_installs_and_runs_pypi_bladebridge (22.341s)
  • 🤪 test_transpiles_informatica_to_sparksql_non_interactive[False] (18.895s)
  • 🤪 test_transpiles_informatica_to_sparksql_non_interactive[True] (18.593s)
  • 🤪 test_transpile_teradata_sql_non_interactive[False] (21.134s)
  • 🤪 test_transpile_teradata_sql (6.436s)
  • 🤪 test_transpile_teradata_sql_non_interactive[True] (5.483s)

Running from acceptance #3443

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 37.50000% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.05%. Comparing base (254b5d3) to head (53864ee).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../labs/lakebridge/assessments/dashboards/execute.py 0.00% 13 Missing ⚠️
.../labs/lakebridge/assessments/profiler_validator.py 0.00% 3 Missing ⚠️
...databricks/labs/lakebridge/assessments/profiler.py 0.00% 2 Missing ⚠️
...cks/labs/lakebridge/assessments/profiler_config.py 80.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2210   +/-   ##
=======================================
  Coverage   64.05%   64.05%           
=======================================
  Files         100      100           
  Lines        8624     8625    +1     
  Branches      893      889    -4     
=======================================
+ Hits         5524     5525    +1     
  Misses       2928     2928           
  Partials      172      172           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

In addition, update tests:

 - No more Path(__file__) manipulation.
 - Test pipeline configurations now use paths relative to the test resources.
from ..conftest import FunctionalTestFile, FunctionalTestFileWithExpectedException, get_functional_test_files


def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you moved test_databricks to test_snowflake

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the pattern for the other ones is to name these after the source system. So the changes here are:

  • The snowflake ones were moved from test_databricks.py to test_snowflake.py.
  • There were 2 sets of functional tests for each source system, in separate files: I've moved them into the same file.

Copy link
Collaborator

@gueniai gueniai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asnare asnare added this pull request to the merge queue Jan 15, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 15, 2026
## Changes

### What does this PR do?

This PR eliminates the use of `Path(__file__)` to locate file-based
resources. In general:

- In the main code, this is buggy: modern Python should use
`importlib.resources` instead.
- In tests, it's brittle and difficult to read because it's normally
based on relative paths and traversal of many parent directories. It's
also unnecessary, because pytest provides a mechanism for locating the
project root. (Tests can also use `importlib.resources`, and probably
should, but that's a bigger refactoring: this is a first step.)

Some incidental changes that are introduced:

 - Type hints in a few places.
- Functional tests against Snowflake, Oracle and Presto have been
consolidated into a single module. (The Snowflake functional tests have
been moved into `test_snowflake.py`: `test_databricks.py` was
misleading.)
- The `PipelineConfig` (and `Step`) classes have been made immutable.
(An unnecessary `__post__init()` method has also been eliminated.)

### Tests

- existing unit tests
- existing integration tests
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 15, 2026
@asnare asnare enabled auto-merge January 19, 2026 11:43
@asnare asnare added this pull request to the merge queue Jan 19, 2026
Merged via the queue into main with commit fa47bd7 Jan 19, 2026
6 checks passed
@asnare asnare deleted the no-more-file-manip branch January 19, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal technical pr's not end user facing tech debt design flaws and other cascading effects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants