Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydvoss committed Jan 22, 2024
1 parent d35b997 commit 6b55bd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def get_aggregated_resources(
try:
detected_resource = future.result(timeout=timeout)
# pylint: disable=broad-except
except concurrent.futures._base.TimeoutError:
except concurrent.futures.TimeoutError:
if detector.raise_on_error:
raise ex
logger.warning(
Expand Down
7 changes: 3 additions & 4 deletions opentelemetry-sdk/tests/resources/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import concurrent.futures
import os
import sys
import unittest
import uuid
from concurrent.futures import TimeoutError
from logging import ERROR, WARNING
from os import environ
from unittest.mock import Mock, patch
Expand Down Expand Up @@ -415,8 +415,7 @@ def test_resource_detector_ignore_error(self):

def test_resource_detector_raise_error(self):
resource_detector = Mock(spec=ResourceDetector)
ex = Exception()
resource_detector.detect.side_effect = ex
resource_detector.detect.side_effect = Exception()
resource_detector.raise_on_error = True
self.assertRaises(
Exception, get_aggregated_resources, [resource_detector]
Expand All @@ -425,7 +424,7 @@ def test_resource_detector_raise_error(self):
@patch("opentelemetry.sdk.resources.logger")
def test_resource_detector_timeout(self, mock_logger):
resource_detector = Mock(spec=ResourceDetector)
resource_detector.detect.side_effect = concurrent.futures._base.TimeoutError()
resource_detector.detect.side_effect = TimeoutError()
resource_detector.raise_on_error = False
self.assertEqual(
get_aggregated_resources([resource_detector]),
Expand Down

0 comments on commit 6b55bd5

Please sign in to comment.