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
python 3.7: coverage fails with TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType #700
Comments
@diefans Thanks for the report. Do you have a reproducible scenario I can try out? |
Something like this: (
export DIR=/tmp/test_cov_ns
rm -rf ${DIR}
mkdir -p ${DIR}/com/foo
cat > ${DIR}/com/foo/mod.py << EOF
def foobar():
pass
EOF
cat > ${DIR}/test_cov.py << EOF
def test_com():
import com.foo.mod
EOF
python3.7 -m venv ${DIR}/venv
${DIR}/venv/bin/pip install pytest coverage
cd ${DIR}; ${DIR}/venv/bin/coverage run --source com.foo ${DIR}/venv/bin/pytest test_cov.py
) In my original scenario one dependency provides a part of the namespace and I call coverage via |
Thanks, this is a great reproducer :) |
haha - finally I made someone happy ;) |
And it turns out this has already been fixed, in c9f4f66 |
This fix is in 4.5.2, just released: https://pypi.org/project/coverage/4.5.2/ |
In Python 3.7 namespace packages seem to have a
__file__ == None
attribute, which leads to coverage not recognizing it.https://github.com/nedbat/coveragepy/blob/coverage-4.5.1x/coverage/control.py#L881
The text was updated successfully, but these errors were encountered: