diff options
author | Benoit Pierre <benoit.pierre@gmail.com> | 2018-01-25 08:36:12 +0100 |
---|---|---|
committer | Benoit Pierre <benoit.pierre@gmail.com> | 2018-01-25 08:49:03 +0100 |
commit | 4d38fb9841d25c6bd5779824a16975ed9ab421b2 (patch) | |
tree | 1d7e73fbf9052cfe78105ab2a839b96709665a80 | |
parent | 618312bec376e5c71b0938a754106973d8889417 (diff) | |
download | external_python_setuptools-4d38fb9841d25c6bd5779824a16975ed9ab421b2.tar.gz external_python_setuptools-4d38fb9841d25c6bd5779824a16975ed9ab421b2.tar.bz2 external_python_setuptools-4d38fb9841d25c6bd5779824a16975ed9ab421b2.zip |
Fix dry-run handling
-rwxr-xr-x | setuptools/command/easy_install.py | 2 | ||||
-rw-r--r-- | setuptools/tests/test_easy_install.py | 45 |
2 files changed, 46 insertions, 1 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index b7396b85..a6f61436 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -828,7 +828,7 @@ class easy_install(Command): target = os.path.join(self.script_dir, script_name) self.add_output(target) - if not self.dry_run: + if self.dry_run: return mask = current_umask() diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 834710ef..57339c8a 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -183,6 +183,51 @@ class TestEasyInstallTest: cmd.ensure_finalized() cmd.easy_install(sdist_unicode) + @pytest.fixture + def sdist_script(self, tmpdir): + files = [ + ( + 'setup.py', + DALS(""" + import setuptools + setuptools.setup( + name="setuptools-test-script", + version="1.0", + scripts=["mypkg_script"], + ) + """), + ), + ( + u'mypkg_script', + DALS(""" + #/usr/bin/python + print('mypkg_script') + """), + ), + ] + sdist_name = 'setuptools-test-script-1.0.zip' + sdist = str(tmpdir / sdist_name) + make_sdist(sdist, files) + return sdist + + @pytest.mark.skipif(not sys.platform.startswith('linux'), + reason="Test can only be run on Linux") + def test_script_install(self, sdist_script, tmpdir, monkeypatch): + """ + Check scripts are installed. + """ + dist = Distribution({'script_args': ['easy_install']}) + target = (tmpdir / 'target').ensure_dir() + cmd = ei.easy_install( + dist, + install_dir=str(target), + args=['x'], + ) + monkeypatch.setitem(os.environ, 'PYTHONPATH', str(target)) + cmd.ensure_finalized() + cmd.easy_install(sdist_script) + assert (target / 'mypkg_script').exists() + class TestPTHFileWriter: def test_add_from_cwd_site_sets_dirty(self): |