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 |
nedbat
added a commit
that referenced
this issue
Nov 3, 2018
nedbat
added a commit
that referenced
this issue
Nov 3, 2018
This fix is in 4.5.2, just released: https://pypi.org/project/coverage/4.5.2/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: