From 901f7cc2a036bfeb93bfbe480608e04c76c2c5ec Mon Sep 17 00:00:00 2001 From: Shashank Singh Date: Sat, 20 Apr 2019 23:24:41 -0400 Subject: Fix error when wheels already exist in dist/ `build_meta.build_wheel` assumes that the only wheel in its output directory is the one it builds, but prior to this, it also used the `dist/` folder as its working output directory. This commit uses a temporary directory instead, preventing an error that was triggered when previously-generated wheel files were still sitting in `dist/`. Fixes GH #1671 --- setuptools/tests/test_build_meta.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_meta.py') diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 90400afc..88e29ffe 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -157,7 +157,6 @@ class TestBuildMetaBackend: assert os.path.isfile(os.path.join(dist_dir, wheel_name)) - @pytest.mark.xfail(reason="Known error, see GH #1671") def test_build_wheel_with_existing_wheel_file_present(self, tmpdir_cwd): # Building a wheel should still succeed if there's already a wheel # in the wheel directory @@ -195,6 +194,12 @@ class TestBuildMetaBackend: assert os.path.isfile(os.path.join(dist_dir, wheel_one)) assert wheel_one != wheel_two + # and if rebuilding the same wheel? + open(os.path.join(dist_dir, wheel_two), 'w').close() + wheel_three = self.get_build_backend().build_wheel(dist_dir) + assert wheel_three == wheel_two + assert os.path.getsize(os.path.join(dist_dir, wheel_three)) > 0 + def test_build_sdist(self, build_backend): dist_dir = os.path.abspath('pip-sdist') os.makedirs(dist_dir) -- cgit v1.2.3