From d513c213d0f69ebaf5a0099c9301649e4bf79ad8 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Thu, 4 Apr 2024 18:49:48 +0200 Subject: [PATCH] Use the newer unittest.mock from standard library on Python 3 --- package.xml | 1 - test/unit_tests/test_environment_cache.py | 5 ++++- test/unit_tests/test_find_in_workspace.py | 5 ++++- test/unit_tests/test_parse_package_xml.py | 5 ++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package.xml b/package.xml index e2dcae1e4..dcadca35b 100644 --- a/package.xml +++ b/package.xml @@ -40,7 +40,6 @@ python3-nose python-mock - python3-mock python-nose python3-nose diff --git a/test/unit_tests/test_environment_cache.py b/test/unit_tests/test_environment_cache.py index 4e92145a0..d436b1873 100644 --- a/test/unit_tests/test_environment_cache.py +++ b/test/unit_tests/test_environment_cache.py @@ -4,7 +4,10 @@ import tempfile import unittest -from mock import Mock +try: + from unittest.mock import Mock +except ImportError: + from mock import Mock try: import catkin.environment_cache diff --git a/test/unit_tests/test_find_in_workspace.py b/test/unit_tests/test_find_in_workspace.py index d205c3a45..e90d877c9 100644 --- a/test/unit_tests/test_find_in_workspace.py +++ b/test/unit_tests/test_find_in_workspace.py @@ -3,7 +3,10 @@ import tempfile import unittest -from mock import Mock +try: + from unittest.mock import Mock +except ImportError: + from mock import Mock try: import catkin diff --git a/test/unit_tests/test_parse_package_xml.py b/test/unit_tests/test_parse_package_xml.py index b65885fdd..0da065996 100644 --- a/test/unit_tests/test_parse_package_xml.py +++ b/test/unit_tests/test_parse_package_xml.py @@ -4,7 +4,10 @@ import tempfile import unittest -from mock import Mock +try: + from mock import Mock +except ImportError: + from mock import Mock imp.load_source('parse_package_xml', os.path.join(os.path.dirname(__file__),