Skip to content

Conversation

@joerick
Copy link
Contributor

@joerick joerick commented Apr 22, 2019

Building on #136 - main differences are

  • environment.json is rolled into each test script
  • the checks are more specific to the exact wheels produced
  • tests are run using pytest for nice output when the assertions fail

@joerick joerick mentioned this pull request Apr 22, 2019
@joerick joerick changed the title Custom test checks alternate! Custom test checks alternate Apr 22, 2019
@YannickJadoul
Copy link
Member

Cool! Using pytest is a great improvement indeed!

I'm still not 100% convinced of getting rid of environment.json and making the cibuildwheel call to be added manually per test. I liked the test script doing all that and enforcing thhat framework. But that's also up to taste, ofc, and maybe I'm overlooking tests we'd like to write?

I'll have a fuller look once I'm behind my laptop screen, but do close #136 if you are happy with this PR :-)


# check that every wheel is produced
if utils.platform == 'linux':
assert glob('wheelhouse/*-cp27-cp27m-manylinux1_x86_64.whl')
Copy link
Member

Choose a reason for hiding this comment

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

What about adding all filenames to utils (possibly in a function that takes project and version parameters, and then generates the filename), and then checking that the (filtered, if not all wheels are being built) set of expected filenames matches the set of filenames found by a single glob('wheelhouse/*.whl')? (I think pytest will give you a diff between the two sets, if that assert fails.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about adding all filenames to utils (possibly in a function that takes project and version parameters, and then generates the filename),

ooh.... i'm maybe... 50/50 on this. I like the explicitness of how it's currently written, it's very clear what's being looked for and the logic is fully within the test. But a set comparison might be neater and we could run it for every test, not just these two. I might try an implementation and see how it feels

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough; just an idea. Indeed, if this works for the basic test and the tests on skipping, that should be enough, and the other tests can focus on something else. I was also just thinking of getting rid of the --print-build-identifiers dependency in the test, since there could be errors in there as well?

import subprocess, sys, os
from glob import glob
project_dir = os.path.dirname(__file__)
sys.path.append(os.path.join(os.path.dirname(project_dir), 'shared'))
Copy link
Member

Choose a reason for hiding this comment

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

Could we set this in the test driver, since it's (by definition) shared by all tests anyway? That's one less line to copy when adding a new test/one less line to change in every test file if there's a bug.

Adding (or appending to) the PYTHONPATH environment variable could work, here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, yes I agree. PYTHONPATH is a good idea! I'll look at changing that.

@joerick
Copy link
Contributor Author

joerick commented Apr 22, 2019

thanks for the review, all good points.

I'm still not 100% convinced of getting rid of environment.json and making the cibuildwheel call to be added manually per test. I liked the test script doing all that and enforcing thhat framework. But that's also up to taste, ofc, and maybe I'm overlooking tests we'd like to write?

On the test framework enforcing a methodology - I think it's a good point, but I'm not sure it's worth the complexity of splitting the test setup and check across two different files - much nicer to have cause and effect right there in one file IMO. But I agree it's a taste thing - I also wasn't keen on the 'environment as a JSON file' thing - never felt all that pleasant to edit JSON files 🤷‍♂️

project_dir = os.path.dirname(__file__)

# build the wheels
subprocess.check_call([sys.executable, '-m', 'cibuildwheel', project_dir])
Copy link
Member

Choose a reason for hiding this comment

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

Minor idea: what about moving this into utils as well? utils.call_cibuildwheel() or so? This gets rid of import subprocess, sys, os as well, and then the test has even more focus on the things we're checking.

Copy link
Member

Choose a reason for hiding this comment

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

(OK, I now see you'd need an env parameter, or add_env, with a dictionary of things to update)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes! I was just now working on something very similar....

image

Copy link
Member

Choose a reason for hiding this comment

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

Yesss, great :-)

For me this takes away the burden that cibuildwheel isn't called from run_test.py, if it's just a single line to write anywa.

@YannickJadoul
Copy link
Member

Great! I've closed #136, because I think this updated version clearly has advantages, so let's continue on this :-)

@joerick
Copy link
Contributor Author

joerick commented Apr 23, 2019

This might now be ready, if it looks good to you @YannickJadoul ?

@YannickJadoul
Copy link
Member

@joerick Sorry for the delay, but as far as I can see, it's great! :-) And it's not very vital functionality for releases, so if we want to tweak further or find inconveniences, we can always update the test framework?

I'll rebase #135 onto this, once it gets merged

@joerick joerick merged commit 719352b into master Apr 25, 2019
YannickJadoul added a commit to YannickJadoul/cibuildwheel that referenced this pull request Apr 27, 2019
YannickJadoul added a commit to YannickJadoul/cibuildwheel that referenced this pull request Apr 27, 2019
YannickJadoul added a commit to YannickJadoul/cibuildwheel that referenced this pull request Apr 28, 2019
YannickJadoul added a commit to YannickJadoul/cibuildwheel that referenced this pull request Apr 28, 2019
@joerick joerick deleted the custom-test-checks branch March 9, 2020 21:27
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