diff options
| author | Éric Araujo <merwok@netwok.org> | 2011-06-10 16:31:40 (GMT) |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2011-06-10 16:31:40 (GMT) |
| commit | fa6cfbc4f73100714bca79280d51836f2bac4bdc (patch) | |
| tree | 3fa5ca9211b9d64ac1c1c6943923183859461538 /Lib/packaging/tests/test_install.py | |
| parent | 2b612220e4ddaea89058065f98735590b710550d (diff) | |
| download | cpython-fa6cfbc4f73100714bca79280d51836f2bac4bdc.zip cpython-fa6cfbc4f73100714bca79280d51836f2bac4bdc.tar.gz cpython-fa6cfbc4f73100714bca79280d51836f2bac4bdc.tar.bz2 | |
Don’t try to install something when running from uninstalled source (#12246).
Original patch by Tshepang Lekhonkhobe.
Diffstat (limited to 'Lib/packaging/tests/test_install.py')
| -rw-r--r-- | Lib/packaging/tests/test_install.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/packaging/tests/test_install.py b/Lib/packaging/tests/test_install.py index c50a45e..35733c8 100644 --- a/Lib/packaging/tests/test_install.py +++ b/Lib/packaging/tests/test_install.py @@ -1,5 +1,7 @@ """Tests for the packaging.install module.""" import os +import logging +from sysconfig import is_python_build from tempfile import mkstemp from packaging import install @@ -357,9 +359,17 @@ class TestInstall(LoggingCatcher, TempdirManager, unittest.TestCase): install._install_dist = old_install_dist def test_install_permission_denied(self): - # if we don't have the access to the installation - # path, we should abort immediatly + # if we don't have access to the installation path, we should abort + # immediately project = os.path.join(os.path.dirname(__file__), 'package.tgz') + + # when running from an uninstalled build, a warning is emitted and the + # installation is not attempted + if is_python_build(): + self.assertFalse(install.install(project)) + self.assertEqual(1, len(self.get_logs(logging.ERROR))) + return + install_path = self.mkdtemp() old_get_path = install.get_path install.get_path = lambda path: install_path |
