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

4.2.1 regression: "assert path.isfile()" hit in python.py:602 #4788

Closed
rouault opened this issue Feb 13, 2019 · 13 comments
Closed

4.2.1 regression: "assert path.isfile()" hit in python.py:602 #4788

rouault opened this issue Feb 13, 2019 · 13 comments
Labels
type: bug problem that needs to be addressed type: regression indicates a problem that was introduced in a release which was working previously

Comments

@rouault
Copy link

rouault commented Feb 13, 2019

My software uses pytest in Travis-CI and it has just caught up with the 4.2.1 release. On a target running under Wine, I now get (extract from https://travis-ci.com/OSGeo/gdal/jobs/177514628 )

=================================== ERRORS ====================================
___________________ ERROR collecting pyscripts/__init__.py ____________________
C:\Python27\lib\site-packages\_pytest\runner.py:226: in from_call
    result = func()
C:\Python27\lib\site-packages\_pytest\runner.py:289: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
C:\Python27\lib\site-packages\_pytest\python.py:650: in collect
    for x in self._collectfile(path):
C:\Python27\lib\site-packages\_pytest\python.py:602: in _collectfile
    assert path.isfile()
E   AssertionError
@rouault
Copy link
Author

rouault commented Feb 13, 2019

Actually this is also true for a pure Windows run on AppVeyor: https://ci.appveyor.com/project/OSGeo/gdal/builds/22342341/job/0vumo9br4uus7jpb

@nicoddemus nicoddemus added type: bug problem that needs to be addressed type: regression indicates a problem that was introduced in a release which was working previously labels Feb 13, 2019
@nicoddemus
Copy link
Member

Thanks for the report @rouault!

@nicoddemus
Copy link
Member

Hmmm that assert was added in 913a2da, cc @blueyed

On a side note, we probably should ban plain assert messages in favor of more descriptive error messages

@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2019

Duplicate of #4782.

#4784 fixes it.

@blueyed blueyed closed this as completed Feb 13, 2019
@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2019

@rouault
Can you debug why that assertion fails for you?
I was currently assuming it would be a dangling symlink.

@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2019

Also please test if #4784 fixes it for you.

@rouault
Copy link
Author

rouault commented Feb 13, 2019

Thanks for the quick response. Unfortunately testing your fix will be impractical while it has not reached pip.
The issue is for some reason Windows specific, as Linux tests pass.
The content of the directory that causes the assertion is
https://github.com/OSGeo/gdal/tree/master/autotest/pyscripts
So it has a "init.py" file of size zero. There is no symlink.

@nicoddemus
Copy link
Member

Thanks @blueyed!

Unfortunately testing your fix will be impractical while it has not reached pip.

@rouault It seems you install pytest with exec { pip install -Ur requirements.txt }, in that case you just need to change the line in requirements.txt from pytest>=3.6.0,<=4.2.0 to git+https://github.com/blueyed/pytest@fix-4782.

@rouault
Copy link
Author

rouault commented Feb 13, 2019

Thanks for the hint ! OK, so I can confirm that fix-4782 solves my issues on Windows.

@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2019

@rouault
Thanks for the feedback.

I would still be interested in what triggers it though.
Note that path is not the __init__.py (from the error message) likely:

this_path = self.fspath.dirpath()
init_module = this_path.join("__init__.py")
if init_module.check(file=1) and path_matches_patterns(
init_module, self.config.getini("python_files")
):
yield Module(init_module, self)
pkg_prefixes = set()
for path in this_path.visit(rec=self._recurse, bf=True, sort=True):

@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2019

@rouault
How did you test it? If you cannot reproduce it locally, maybe we could use a branch without the fix, but display the actual path?

@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2019

@rouault
You could try the assert branch: #4790

@rouault
Copy link
Author

rouault commented Feb 13, 2019

How did you test it?

I updated my requirements.txt to git+https://github.com/blueyed/pytest@fix-4782 and pushed that to get a new AppVeyor run

You could try the assert branch: #4790

Will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed type: regression indicates a problem that was introduced in a release which was working previously
Projects
None yet
Development

No branches or pull requests

3 participants