@@ -118,10 +118,9 @@ def test_warning_logs_not_generated(self):
118
118
119
119
@patch ('airflow.providers_manager.importlib.import_module' )
120
120
def test_hooks (self , mock_import_module ):
121
- # importlib-resources>=5.2 relies on importing the containing module to
122
- # read its content. The provider manager needs to read the validation
123
- # schema 'provider_info.schema.json'. Not sure why this needs to be
124
- # called twice. Also see comment on the assert at the end of the function.
121
+ # importlib.resources relies on importing the containing module to read
122
+ # its content. The provider manager needs to read two validation schemas
123
+ # 'provider_info.schema.json' and 'customized_form_field_behaviours.schema.json'.
125
124
mock_import_module .side_effect = [airflow , airflow ]
126
125
127
126
with pytest .warns (expected_warning = None ) as warning_records :
@@ -132,12 +131,12 @@ def test_hooks(self, mock_import_module):
132
131
assert [] == [w .message for w in warning_records .list if "hook-class-names" in str (w .message )]
133
132
assert len (self ._caplog .records ) == 0
134
133
135
- # The stdlib importlib.resources implementation in 3.7 through 3. 9 does
136
- # not rely on importlib.import_module, so the function should not be
137
- # called. The implementation for 3.10+ and the backport to 3.6 uses it
138
- # to import the top-level 'airflow' for 'provider_info. schema.json'.
139
- # Also see comment on mocking at the beginning of the function.
140
- if ( 3 , 7 ) <= sys .version_info < (3 , 10 ):
134
+ # The stdlib importlib.resources implementation in 3.9 does not rely on
135
+ # importlib.import_module, so the function should not be called. The
136
+ # implementation for 3.10+ and the backport we use for up to 3.8 uses it
137
+ # to import the top-level 'airflow' for the two schema files. Also see
138
+ # comment on mocking at the beginning of the function.
139
+ if sys .version_info [: 2 ] == (3 , 9 ):
141
140
assert mock_import_module .mock_calls == []
142
141
else :
143
142
assert mock_import_module .mock_calls == [call ("airflow" ), call ("airflow" )]
0 commit comments