Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Dec 27, 2024

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.


^ 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.rst or {issue_number}.significant.rst, in newsfragments.

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.
@potiuk
Copy link
Member Author

potiuk commented Dec 27, 2024

Discovered when looking why #45249 has been failing - very interesting side-effect in our tests

Copy link
Member

@gopidesupavan gopidesupavan left a comment

Choose a reason for hiding this comment

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

Interesting one :)

@potiuk
Copy link
Member Author

potiuk commented Dec 27, 2024

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"

@potiuk potiuk merged commit aab2b88 into apache:main Dec 27, 2024
67 checks passed
@potiuk 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants