From 732f5e89a8e417ff536d9a51a85d7b328e80dab1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 26 Jan 2015 08:29:56 -0500 Subject: Add test capturing Attribute error. Ref #339. --- setuptools/tests/test_easy_install.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'setuptools/tests/test_easy_install.py') diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index ab6a8f0d..4331d30e 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -13,6 +13,7 @@ import contextlib import tarfile import logging import itertools +import distutils.errors import pytest try: @@ -110,6 +111,16 @@ class TestEasyInstallTest: keys = sorted(cmd.package_index.scanned_urls.keys()) assert keys == ['link1', 'link2'] + def test_write_exception(self): + """ + Test that `cant_write_to_target` is rendered as a DistutilsError. + """ + dist = Distribution() + cmd = ei.easy_install(dist) + cmd.install_dir = os.getcwd() + with pytest.raises(distutils.errors.DistutilsError): + cmd.cant_write_to_target() + class TestPTHFileWriter: def test_add_from_cwd_site_sets_dirty(self): -- cgit v1.2.1