Skip to content

Commit 375ea62

Browse files
committed
small fixup of #352
This commit changed the test_subpackage build command, but left the now unnecessary '--sdist' and '--wheel' parameters. They are on by default for `python -m build`
1 parent f406d26 commit 375ea62

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/test_project.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_tox(baked_with_development_dependencies, project_env_bin_dir):
8080

8181

8282
def test_subpackage(baked_with_development_dependencies, project_env_bin_dir):
83-
"""Test if subpackages end up in sdist and bdist_wheel distributions"""
83+
"""Test if subpackages end up in (wheel) distributions"""
8484
project_dir = baked_with_development_dependencies
8585
bin_dir = project_env_bin_dir
8686
subpackage = (project_dir / 'my_python_package' / 'mysub')
@@ -91,9 +91,14 @@ def test_subpackage(baked_with_development_dependencies, project_env_bin_dir):
9191
subsubpackage.mkdir()
9292
(subsubpackage / '__init__.py').write_text('FOO = "bar"\n', encoding="utf-8")
9393

94-
# sdist and bdist_wheel both call build command to create build/ dir
95-
# So instead of looking in distribution archives we can look in build/ dir
96-
result = run([f'{bin_dir}python', '-m', 'build', '--sdist', '--wheel'], project_dir)
94+
# Note: we pass --wheel explicitly, because wheel has a useful side-effect
95+
# of leaving a build directory after building that we can check for its
96+
# contents in the asserts below. However, be aware that this behavior is
97+
# not guaranteed to stay and is in fact a known bug / PEP-violation!
98+
# See https://github.com/pypa/wheel/issues/447. Also, by passing --wheel
99+
# explicitly (although by default build already builds a wheel as well),
100+
# we omit the sdist being built, saving some seconds.
101+
result = run([f'{bin_dir}python', '-m', 'build', '--wheel'], project_dir)
97102
assert result.returncode == 0
98103
assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / '__init__.py').exists()
99104
assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / 'mysub2' / '__init__.py').exists()

0 commit comments

Comments
 (0)