Commit 12d4fba6 authored by xoviat's avatar xoviat

tests: add build_wheel and build_sdist

parent 33546858
......@@ -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
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment