Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: simplify pep518 test setup #212

Merged
merged 3 commits into from
Nov 17, 2022
Merged

Conversation

dnicolodi
Copy link
Member

No description provided.

@dnicolodi dnicolodi force-pushed the tests-tweaks branch 3 times, most recently from 17a650a to 2592309 Compare November 17, 2022 10:12
@dnicolodi dnicolodi requested a review from henryiii November 17, 2022 10:13
@dnicolodi dnicolodi force-pushed the tests-tweaks branch 2 times, most recently from 11fd293 to bdd6376 Compare November 17, 2022 10:21
@dnicolodi
Copy link
Member Author

@henryiii I took the freedom to tweak the pep518 test setup in the way I had in mind. Please have a look. I think this is easier. I still don't understand why meson-python does not list wheel as a dependency, given that it requires it. For #175, once you remove ninja from the meson-python dependencies, we need to verify if it will still be placed in thewheelhouse because it is a build dependency for meson-python or not. For doing that, I simply place a breakpoint at the end of pep518_wheelhouse() and list the content of the wheelhouse with os.listdir().

@rgommers
Copy link
Contributor

@henryiii I took the freedom to tweak the pep518 test setup in the way I had in mind. Please have a look. I think this is easier. I still don't understand why meson-python does not list wheel as a dependency, given that it requires it

Agreed, this is not great. The intent is micro-optimization of not installing things in the build env when they are not needed for isolated builds. However, that breaks non-isolated builds - which the kind of projects that are moving to Meson need all the time. So it is more harmful than helpful.

Maybe let's move that to a separate PR or issue?

@dnicolodi
Copy link
Member Author

That makes sense. We may be moving away from using wheel because of the issue with the promise of a stable API or the lack of it (and because we may want to merge meson-python into Meson at some point) thus the problem may go away I didn't mean to resolve this issue in this PR or in #175.

@@ -15,10 +15,9 @@
@pytest.mark.parametrize(
'build_arg', ['', '--wheel'], ids=['sdist_to_wheel', 'wheel_directly']
)
@pytest.mark.xfail(sys.platform.startswith('cygwin'), reason='ninja pip package not available on cygwin', strict=True)
Copy link
Contributor

@henryiii henryiii Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed? The point of the test is to test that this breaks - that is, ninja's not available from PyPI on cygwin. So if this passes on Cygwin before #175 goes in, the test doesn't work. That's why it was a strict xfail.

I'm not completely sure what changed to make this pass, as this looks similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, now I know why it's passing. That's okay, I think - then we can delete ninja from the wheelhouse manually for #175. The only think that lightly bothers me is the check_call change, then.

Copy link
Member Author

@dnicolodi dnicolodi Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if we remove ninja from meson-python's dependencies list it will not be put in the wheelhouse anymore. But the documentation is not crystal clear on this. I'll have to check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm that once ninja is removed from meson-python's dependencies it is not added to the wheelhouse anymore.

Comment on lines 24 to 23
subprocess.run([sys.executable, '-m', 'build', f'--outdir={dist}', *build_args], cwd=package_dir, check=True)
subprocess.check_call([sys.executable, '-m', 'build', '--outdir', str(dist), *build_args])
Copy link
Contributor

@henryiii henryiii Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you replacing run with check_call? check_call and check_output are the old, pre Python 3.5 API, and the Python docs recommend run instead. The rest of the calls should be changed to run long-term, I think, not the other way around?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I saw that the rest of the code uses the "old" API and I assumed it is the recommended one. Switching it back and probably adding a commit to clean up the other call sites too.

meson_python = str(package_dir.parent.parent)
# Populate wheelhouse with wheel for the following packages and
# their dependencies. Wheels are downloaded from PyPI or built
# from the source distribution as needed. Sources or wheels in
Copy link
Contributor

@henryiii henryiii Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, it's building ninja from source on Cygwin here, that's why it's passing below. In my version, it was also building ninja from source in order to build meson, but it wasn't putting it into the wheelhouse.

@henryiii
Copy link
Contributor

Listing wheel as a dependency until recently pulled in setuptools.

This also makes the test work on Cygwin where a ninja wheel is not
available and needs to be built from the source distribution.
@dnicolodi dnicolodi force-pushed the tests-tweaks branch 2 times, most recently from bcbbd80 to 8d88f2c Compare November 17, 2022 15:47
@dnicolodi dnicolodi merged commit f90f6f4 into mesonbuild:main Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants