Skip to content

Commit

Permalink
Fix mock in test_cached_files_are_used_when_internet_is_down (#18804)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin authored Aug 29, 2022
1 parent 8b67f20 commit 169b8cd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_configuration_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ def test_cached_files_are_used_when_internet_is_down(self):
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.json.return_value = {}

# Download this model to make sure it's in the cache.
_ = BertConfig.from_pretrained("hf-internal-testing/tiny-random-bert")
Expand Down
1 change: 1 addition & 0 deletions tests/test_feature_extraction_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def test_cached_files_are_used_when_internet_is_down(self):
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.json.return_value = {}

# Download this model to make sure it's in the cache.
_ = Wav2Vec2FeatureExtractor.from_pretrained("hf-internal-testing/tiny-random-wav2vec2")
Expand Down
1 change: 1 addition & 0 deletions tests/test_modeling_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2931,6 +2931,7 @@ def test_cached_files_are_used_when_internet_is_down(self):
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.json.return_value = {}

# Download this model to make sure it's in the cache.
_ = BertModel.from_pretrained("hf-internal-testing/tiny-random-bert")
Expand Down
1 change: 1 addition & 0 deletions tests/test_modeling_tf_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,7 @@ def test_cached_files_are_used_when_internet_is_down(self):
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.json.return_value = {}

# Download this model to make sure it's in the cache.
_ = TFBertModel.from_pretrained("hf-internal-testing/tiny-random-bert")
Expand Down
1 change: 1 addition & 0 deletions tests/test_tokenization_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3875,6 +3875,7 @@ def test_cached_files_are_used_when_internet_is_down(self):
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.json.return_value = {}

# Download this model to make sure it's in the cache.
_ = BertTokenizer.from_pretrained("hf-internal-testing/tiny-random-bert")
Expand Down

0 comments on commit 169b8cd

Please sign in to comment.