aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxoviat <xoviat@users.noreply.github.com>2017-09-03 22:16:34 -0500
committerxoviat <xoviat@users.noreply.github.com>2017-09-07 21:42:07 -0500
commit12d4fba61cb8a8533566dafdae8874b617aaedbd (patch)
tree916ee7ef511ee8bd022fc920321118950c4099ab
parent33546858db9b960be11c384f608528b127ca7923 (diff)
downloadexternal_python_setuptools-12d4fba61cb8a8533566dafdae8874b617aaedbd.tar.gz
external_python_setuptools-12d4fba61cb8a8533566dafdae8874b617aaedbd.tar.bz2
external_python_setuptools-12d4fba61cb8a8533566dafdae8874b617aaedbd.zip
tests: add build_wheel and build_sdist
-rw-r--r--setuptools/pep517.py11
-rw-r--r--setuptools/tests/test_pep517.py24
2 files changed, 32 insertions, 3 deletions
diff --git a/setuptools/pep517.py b/setuptools/pep517.py
index b3535790..4ba23552 100644
--- a/setuptools/pep517.py
+++ b/setuptools/pep517.py
@@ -68,6 +68,11 @@ def build_wheel(wheel_directory, config_settings=None,
shutil.rmtree(wheel_directory)
shutil.copytree('dist', wheel_directory)
+ wheels = [f for f in os.listdir(wheel_directory)
+ if f.endswith('.whl')]
+
+ assert len(wheels) == 1
+ return wheels[0]
def build_sdist(sdist_directory, config_settings=None):
config_settings = fix_config(config_settings)
@@ -78,3 +83,9 @@ def build_sdist(sdist_directory, config_settings=None):
if sdist_directory != 'dist':
shutil.rmtree(sdist_directory)
shutil.copytree('dist', sdist_directory)
+
+ sdists = [f for f in os.listdir(sdist_directory)
+ if f.endswith('.tar.gz')]
+
+ assert len(sdists) == 1
+ return sdists[0] \ No newline at end of file
diff --git a/setuptools/tests/test_pep517.py b/setuptools/tests/test_pep517.py
index fd0a1965..0dd38b1b 100644
--- a/setuptools/tests/test_pep517.py
+++ b/setuptools/tests/test_pep517.py
@@ -28,7 +28,8 @@ class BuildBackend(object):
def method(*args, **kw):
return self.pool.submit(
- BuildBackendCaller(self.cwd, self.env, self.backend_name),
+ BuildBackendCaller(os.path.abspath(self.cwd), self.env,
+ self.backend_name),
(name, args, kw)).result()
return method
@@ -66,7 +67,7 @@ def build_backend():
setup(
name='foo',
py_modules=['hello'],
- setup_requires=['test-package'],
+ setup_requires=['six'],
entry_points={'console_scripts': ['hi = hello.run']},
zip_safe=False,
)
@@ -86,4 +87,21 @@ def build_backend():
def test_get_requires_for_build_wheel(build_backend):
with build_backend as b:
assert list(sorted(b.get_requires_for_build_wheel())) == \
- list(sorted(['test-package', 'setuptools', 'wheel']))
+ list(sorted(['six', 'setuptools', 'wheel']))
+
+def test_build_wheel(build_backend):
+ with build_backend as b:
+ dist_dir = os.path.abspath('pip-wheel')
+ os.makedirs(dist_dir)
+ wheel_name = b.build_wheel(dist_dir)
+
+ assert os.path.isfile(os.path.join(dist_dir, wheel_name))
+
+
+def test_build_sdist(build_backend):
+ with build_backend as b:
+ dist_dir = os.path.abspath('pip-sdist')
+ os.makedirs(dist_dir)
+ sdist_name = b.build_sdist(dist_dir)
+
+ assert os.path.isfile(os.path.join(dist_dir, sdist_name)) \ No newline at end of file