-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix test collection for Connection and Variables for non-db tests #45249
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
Fix test collection for Connection and Variables for non-db tests #45249
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.
|
Discovered when looking why #45249 has been failing - very interesting side-effect in our tests |
gopidesupavan
left a comment
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.
Interesting one :)
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" |
…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.
…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.
…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.
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.