diff --git a/Changelog.md b/Changelog.md index a9b4644a..f2f32c0d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,12 @@ rules on making a good Changelog. version to `delocate==0.11.0`. [#215](https://github.com/matthew-brett/delocate/pull/215) +### Fixed + +- Existing libraries causing DelocationError were not shown due to bad string + formatting. + [#216](https://github.com/matthew-brett/delocate/pull/216) + ## [0.11.0] - 2024-03-22 ### Added diff --git a/delocate/tests/test_delocating.py b/delocate/tests/test_delocating.py index 2ea0f3ee..f2422fb5 100644 --- a/delocate/tests/test_delocating.py +++ b/delocate/tests/test_delocating.py @@ -114,7 +114,9 @@ def test_delocate_tree_libs( sys_lib = EXT_LIBS[0] lib_dict = without_system_libs(tree_libs_func(subtree)) lib_dict.update({"/unlikely/libname.dylib": {}}) - with pytest.raises(DelocationError): + with pytest.raises( + DelocationError, match=r".*/unlikely/libname.dylib.*does not exist" + ): delocate_tree_libs(lib_dict, copy_dir, subtree) lib_dict = without_system_libs(tree_libs_func(subtree)) @@ -171,7 +173,9 @@ def test_delocate_tree_libs( # out-of-tree will raise an error because of duplicate library names # (libc and slibc both named /libc.dylib) lib_dict2 = without_system_libs(tree_libs_func(subtree2)) - with pytest.raises(DelocationError): + with pytest.raises( + DelocationError, match=r".*liba.dylib .*already exists.*liba.dylib" + ): delocate_tree_libs(lib_dict2, copy_dir2, "/fictional") # Rename a library to make this work new_slibc = pjoin(dirname(slibc), "libc2.dylib") @@ -365,7 +369,10 @@ def filt_func(libname: Text) -> bool: shutil.copy2(libb, "subtree") # If liba is already present, barf shutil.copy2(liba, "subtree") - assert_raises(DelocationError, copy_recurse, "subtree", filt_func) + with pytest.raises( + DelocationError, match=r".*liba.dylib .*already exists" + ): + copy_recurse("subtree", filt_func) # Works if liba not present os.unlink(pjoin("subtree", "liba.dylib")) copy_recurse("subtree", filt_func)