-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Improve TestUnpackArchives to also test the contents of the extracted files #5891
Conversation
d851634
to
a3aa84c
Compare
Hmm, @pradyunsg, do you know why this PR might be failing on unrelated tests for the following two Windows environments on AppVeyor?
I'm a little mystified and thought you might have more experience here. |
I got that occasionally on the PEP 517 work. It seemed to disappear of its own accord, though, so I never worked out what the problem was. I suspect some sort of "path nested too deeply" or "path too long" issue, maybe? We do have some pretty deep nesting in the tests. |
@pfmoore Thanks for the thought. It could certainly be something like that. The odd thing is that I think earlier versions of this PR only added code paths that weren't executed on Windows, so I'm not sure how it could trigger different behavior with respect to paths. Also, there are lines like this in the logs. Script result: pip install --user INITools==0.1 --no-binary=:all: Notice that this substring occurs twice in the path. Maybe that's related to the issue, but I'm not sure what could be causing it:
|
Yes, that's what I saw with my failures too. As I say, I'm pretty sure when it happened to me I made a change that could have had no impact on that problem, and the issue went away in the next test run anyway. It looks like something might be misusing one of our test fixtures (that path looks like something generated from the pytest |
a3aa84c
to
21f7df3
Compare
Starting to hit that too, might be the new pytest release, looking into it. |
Definitively due to the new pytest release, still not sure why (might be a combination of issues: longer paths, |
So this is due to 2 changes with the new pytest release:
|
Thanks for investigating, @benoit-pierre! Is there any discussion on the pytest tracker or release notes explaining why the change was made? Also, for the second issue, why weren't the tests always failing, then? Is there some indeterminism in the path that can affect the path's length? |
It is deterministic. The maximum path length used by a test is determined by its name, using pytest-xdist, and things like using |
Oh, I see. I misunderstood. So pytest changed their base directory name in the new release.. |
That, and our trick with |
21f7df3
to
3f1f802
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor point, but otherwise this looks good.
tests/unit/test_utils.py
Outdated
path = os.path.join(self.tempdir, fname) | ||
if path.endswith('symlink.txt') and sys.platform == 'win32': | ||
# no symlinks created on windows | ||
continue | ||
assert test(path), path | ||
if expected_contents is not None: | ||
with open(path) as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe explicitly set an encoding here? Or read (and make the expected value) bytes? The expected data is all ASCII, so it shouldn't in theory matter, but explicit is better than implicit and all that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @pfmoore. Good point. Originally I thought about making it bytes, but then I saw the tests were passing anyways, so I didn't think I needed to. :) I'll go ahead and change it because I agree the definiteness is better.
@cjerdonek I've been AWOL for a bit. There's been a lot of stuff happening lately for me. Thanks for some awesome investigative work @benoit-pierre! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
In the process of reviewing PR #5848, I noticed that
TestUnpackArchives
doesn't actually test if the file contents are extracted correctly when unpacking. So this PR adds that to the existing tests.