-
Notifications
You must be signed in to change notification settings - Fork 82
Eliminate Path(__file__) to locate resource files
#2210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ed for tests. This removes the need for `Path(__file__)`-based manipulation.
|
✅ 51/51 passed, 5 flaky, 4m13s total Flaky tests:
Running from acceptance #3354 |
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
In addition, update tests: - No more Path(__file__) manipulation. - Test pipeline configurations now use paths relative to the test resources.
Note: the path being loaded doesn't seem to exist, so it's possible that this was broken before (and still is).
| # TODO: Verify this, I don't think it works? (These files are part of the test resources.) | ||
| schema_def = resources.files(assessment_resources).joinpath(f"{source_tech}_schema_def.yml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this worked prior to this PR (or after): this is a pure refactoring.
But it does raise an interesting point: how is this tested?
@sundarshankar89: How can I check this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be the source resources directory, not part of tests.
@goodwillpunning correct me if I'm wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sundarshankar89, @goodwillpunning: The only resource I can find is: tests/resources/assessments/synapse_schema_def.yml
If this is not working, I propose creating an issue for this and fixing it independently of this PR.
| from ..conftest import FunctionalTestFile, FunctionalTestFileWithExpectedException, get_functional_test_files | ||
|
|
||
|
|
||
| def pytest_generate_tests(metafunc: pytest.Metafunc) -> None: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.pytotest_snowflake.py. - There were 2 sets of functional tests for each source system, in separate files: I've moved them into the same file.
Changes
What does this PR do?
This PR eliminates the use of
Path(__file__)to locate file-based resources. In general:importlib.resourcesinstead.importlib.resources, and probably should, but that's a bigger refactoring: this is a first step.)Some incidental changes that are introduced:
test_snowflake.py:test_databricks.pywas misleading.)PipelineConfig(andStep) classes have been made immutable. (An unnecessary__post__init()method has also been eliminated.)Tests