From e4aa9070e7196975edb41f8dcaccf8eccbf83b2e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 29 May 2020 18:21:24 -0400 Subject: Setuptools no longer installs a site.py file during easy_install or develop installs. Ref #2165. --- setuptools/tests/test_easy_install.py | 8 -------- 1 file changed, 8 deletions(-) (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 3044cbd0..e8ebd320 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -61,14 +61,6 @@ SETUP_PY = DALS(""" class TestEasyInstallTest: - def test_install_site_py(self, tmpdir): - dist = Distribution() - cmd = ei.easy_install(dist) - cmd.sitepy_installed = False - cmd.install_dir = str(tmpdir) - cmd.install_site_py() - assert (tmpdir / 'site.py').exists() - def test_get_script_args(self): header = ei.CommandSpec.best().from_environment().as_header() expected = header + DALS(r""" -- cgit v1.2.1 From 01121d057bea0128c34a92813c51ba3ec4902fce Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 14 Jun 2020 12:58:52 -0400 Subject: Decrease start-up time of editable-installed entry points on newer versions of Python --- setuptools/tests/test_easy_install.py | 44 ++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 13 deletions(-) (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 3044cbd0..58108db6 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -71,19 +71,37 @@ class TestEasyInstallTest: def test_get_script_args(self): header = ei.CommandSpec.best().from_environment().as_header() - expected = header + DALS(r""" - # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' - __requires__ = 'spec' - import re - import sys - from pkg_resources import load_entry_point - - if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit( - load_entry_point('spec', 'console_scripts', 'name')() - ) - """) # noqa: E501 + try: + from importlib.metadata import distribution # noqa: F401 + + expected = header + DALS(r""" + # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' + __requires__ = 'spec' + import re + import sys + from importlib.metadata import distribution + + if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + for entry_point in distribution('spec').entry_points: + if entry_point.group == 'console_scripts' and entry_point.name == 'name': + sys.exit(entry_point.load()()) + """) # noqa: E501 + except ImportError: + expected = header + DALS(r""" + # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' + __requires__ = 'spec' + import re + import sys + from pkg_resources import load_entry_point + + if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit( + load_entry_point('spec', 'console_scripts', 'name')() + ) + """) # noqa: E501 + dist = FakeDist() args = next(ei.ScriptWriter.get_args(dist)) -- cgit v1.2.1 From d6501f3c75384340f1742a864c1ffa76977437b6 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 14 Jun 2020 14:21:26 -0400 Subject: address --- setuptools/tests/test_easy_install.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (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 58108db6..9aa2bd63 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -71,9 +71,7 @@ class TestEasyInstallTest: def test_get_script_args(self): header = ei.CommandSpec.best().from_environment().as_header() - try: - from importlib.metadata import distribution # noqa: F401 - + if sys.version_info >= (3, 8): expected = header + DALS(r""" # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' __requires__ = 'spec' @@ -87,7 +85,7 @@ class TestEasyInstallTest: if entry_point.group == 'console_scripts' and entry_point.name == 'name': sys.exit(entry_point.load()()) """) # noqa: E501 - except ImportError: + else: expected = header + DALS(r""" # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' __requires__ = 'spec' -- cgit v1.2.1 From f8cd1f258f4b3f52521db2a12bfbd0832fb2e9fa Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 14 Jun 2020 21:04:04 -0400 Subject: address --- setuptools/tests/test_easy_install.py | 1 - 1 file changed, 1 deletion(-) (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 9aa2bd63..345823cf 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -74,7 +74,6 @@ class TestEasyInstallTest: if sys.version_info >= (3, 8): expected = header + DALS(r""" # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' - __requires__ = 'spec' import re import sys from importlib.metadata import distribution -- cgit v1.2.1 From a4d8518c7b3cadf5e008871cf0d8c2d02a6a4492 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 15 Jun 2020 08:55:00 -0400 Subject: Make a few assertions about the entry point script rather than keeping a fully-rendered copy. --- setuptools/tests/test_easy_install.py | 38 +++++++---------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (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 345823cf..8611dc16 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -16,6 +16,7 @@ import io import zipfile import mock import time +import re from setuptools.extern import six @@ -71,40 +72,15 @@ class TestEasyInstallTest: def test_get_script_args(self): header = ei.CommandSpec.best().from_environment().as_header() - if sys.version_info >= (3, 8): - expected = header + DALS(r""" - # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' - import re - import sys - from importlib.metadata import distribution - - if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - for entry_point in distribution('spec').entry_points: - if entry_point.group == 'console_scripts' and entry_point.name == 'name': - sys.exit(entry_point.load()()) - """) # noqa: E501 - else: - expected = header + DALS(r""" - # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' - __requires__ = 'spec' - import re - import sys - from pkg_resources import load_entry_point - - if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit( - load_entry_point('spec', 'console_scripts', 'name')() - ) - """) # noqa: E501 - dist = FakeDist() - args = next(ei.ScriptWriter.get_args(dist)) name, script = itertools.islice(args, 2) - - assert script == expected + assert script.startswith(header) + assert "'spec'" in script + assert "'console_scripts'" in script + assert "'name'" in script + assert re.search( + '^# EASY-INSTALL-ENTRY-SCRIPT', script, flags=re.MULTILINE) def test_no_find_links(self): # new option '--no-find-links', that blocks find-links added at -- cgit v1.2.1 From fb7ab81a3d080422687bad71f9ae9d36eeefbee2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 16 Aug 2020 00:29:24 -0400 Subject: Remove Python 2 compatibility --- setuptools/tests/test_easy_install.py | 8 -------- 1 file changed, 8 deletions(-) (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 c07b5bea..26a5e9a6 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -1,7 +1,5 @@ -# -*- coding: utf-8 -*- """Easy install Tests """ -from __future__ import absolute_import, unicode_literals import sys import os @@ -18,8 +16,6 @@ import mock import time import re -from setuptools.extern import six - import pytest from setuptools import sandbox @@ -41,8 +37,6 @@ from . import contexts from .files import build_files from .textwrap import DALS -__metaclass__ = type - class FakeDist: def get_entry_map(self, group): @@ -984,8 +978,6 @@ def create_setup_requires_package(path, distname='foobar', version='0.1', ) class TestScriptHeader: non_ascii_exe = '/Users/José/bin/python' - if six.PY2: - non_ascii_exe = non_ascii_exe.encode('utf-8') exe_with_spaces = r'C:\Program Files\Python36\python.exe' def test_get_script_header(self): -- cgit v1.2.1