Fix test collection for Connection and Variables for non-db tests - #45249
Merged
potiuk merged 1 commit intoDec 27, 2024
Merged
Conversation
When Tests were collected for microsoft provider alone for non-db
tests, Connection were used in "parametrized" to perameterize the
tests. This was only working accidentally so far because all ORM
models were loaded before in other tests - including Triggers -and
then the connection objects did not trigger any DB operations. But
when microsoft provider tests were run first (and in separation),
the Triggers were not imported and Connection creation caused error:
> When initializing mapper mapped class AssetModel->asset, expression
'Trigger' failed to locate a name ('Trigger') # Please enter the commit
message for your changes. Lines starting
This can be mitigated (as already advised in unit tests documentation)
by replacing Connections with MagicMock.
Member
Author
|
Discovered when looking why #45249 has been failing - very interesting side-effect in our tests |
Member
Author
Indeed - we should likely improve some of the diagnostics there and fail "earlier" and with "clearer" message - but for now this one should be "good enough" |
jscheffl
approved these changes
Dec 27, 2024
potiuk
deleted the
make-microsoft-azure-non-db-tests-collection-works
branch
December 27, 2024 20:23
jason810496
pushed a commit
to jason810496/airflow
that referenced
this pull request
Dec 28, 2024
…ache#45249) When Tests were collected for microsoft provider alone for non-db tests, Connection were used in "parametrized" to perameterize the tests. This was only working accidentally so far because all ORM models were loaded before in other tests - including Triggers -and then the connection objects did not trigger any DB operations. But when microsoft provider tests were run first (and in separation), the Triggers were not imported and Connection creation caused error: > When initializing mapper mapped class AssetModel->asset, expression 'Trigger' failed to locate a name ('Trigger') # Please enter the commit message for your changes. Lines starting This can be mitigated (as already advised in unit tests documentation) by replacing Connections with MagicMock.
HariGS-DB
pushed a commit
to HariGS-DB/airflow
that referenced
this pull request
Jan 16, 2025
…ache#45249) When Tests were collected for microsoft provider alone for non-db tests, Connection were used in "parametrized" to perameterize the tests. This was only working accidentally so far because all ORM models were loaded before in other tests - including Triggers -and then the connection objects did not trigger any DB operations. But when microsoft provider tests were run first (and in separation), the Triggers were not imported and Connection creation caused error: > When initializing mapper mapped class AssetModel->asset, expression 'Trigger' failed to locate a name ('Trigger') # Please enter the commit message for your changes. Lines starting This can be mitigated (as already advised in unit tests documentation) by replacing Connections with MagicMock.
got686-yandex
pushed a commit
to got686-yandex/airflow
that referenced
this pull request
Jan 30, 2025
…ache#45249) When Tests were collected for microsoft provider alone for non-db tests, Connection were used in "parametrized" to perameterize the tests. This was only working accidentally so far because all ORM models were loaded before in other tests - including Triggers -and then the connection objects did not trigger any DB operations. But when microsoft provider tests were run first (and in separation), the Triggers were not imported and Connection creation caused error: > When initializing mapper mapped class AssetModel->asset, expression 'Trigger' failed to locate a name ('Trigger') # Please enter the commit message for your changes. Lines starting This can be mitigated (as already advised in unit tests documentation) by replacing Connections with MagicMock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Tests were collected for microsoft provider alone for non-db tests, Connection were used in "parametrized" to perameterize the tests. This was only working accidentally so far because all ORM models were loaded before in other tests - including Triggers -and then the connection objects did not trigger any DB operations. But when microsoft provider tests were run first (and in separation), the Triggers were not imported and Connection creation caused error:
This can be mitigated (as already advised in unit tests documentation) by replacing Connections with MagicMock.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.