Closed drew-parsons closed 4 years ago
@RizzerOnGitHub how did you install pytest-mpi, having a version mpi-0+unknown suggests you've got something weird going on (the very first commit has mpi-0.1)? Testing this on my desktop (unstable, setting pytest==4.6.9 with tox.ini) has the tests pass fine.
Testing on Debian unstable, with deb package python3-pytest-mpi 0.3+git20191218.a8e7b56-2 installed. The comes from git 20191218 commit a8e7b56. Build logs are available at https://buildd.debian.org/status/package.php?p=pytest-mpi
I guess 0+unknown comes from a NameError in _version.get_versions() when trying to read root = os.path.realpath(__file__)
or root = os.path.dirname(root)
, ll.493-501 in _version.py.
import pytest_mpi
os.path.realpath(pytest_mpi.__file__)
returns '/usr/lib/python3/dist-packages/pytest_mpi/__init__.py'
Setting root
to that string,
for i in root.split('/'):
root = os.path.dirname(root)
returns root
as '/'
.
~So~ But the NameError ~must~ oughtn't come from cfg.versionfile_source.split('/')
.
cfg.versionfile_source
is "pytest_mpi/_version.py"
But
for i in "pytest_mpi/_version.py".split('/'):
root = os.path.dirname(root)
returns root as '/usr/lib/python3/dist-packages'
Not clear why get_versions() would be getting a NameError here.
Oh wait, the installed version file differs from the source file:
$ cat /usr/lib/python3/dist-packages/pytest_mpi/_version.py
# This file was generated by 'versioneer.py' (0.18) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
import json
version_json = '''
{
"date": null,
"dirty": false,
"error": "no suitable tags",
"full-revisionid": "a8e7b56301611621004e8551b5bf785bc2810c57",
"version": "0+unknown"
}
''' # END VERSION_JSON
def get_versions():
return json.loads(version_json)
Looks like versioneer.py is overriding the file you've got in source.
Which I gather it's meant to do. The build log has
copying pytest_mpi/_version.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi
copying pytest_mpi/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi
UPDATING /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi/_version.py
set /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi/_version.py to '0+unknown'
with UPDATING and set happening in versioneer.py. Why is versioneer.py applying version='0+unknown' ?
Yep, versioneer manages _version.py
, possibly it due to how you're building it? It's not that important.
Where does autopackagetest run? I realise I didn't use src this time, I probably should've, as I know can conflicts between an installed package and the package in the current dir (though that's usually only if you've got a binary package). I can move to using src, but that doesn't explain why pytest is failing. I presume there's no unusual patches to pytest within Debian?
Do you mean autopkgtest used for the Debian CI tests? The tests are defined in debian/tests but that doesn't exist yet. So debci is only running a nominal superficial test (python3 -c "import pytest_mpi"
), it's not yet running pytest-3.
I'm running pytest-3 manually from the top level of the source (I want the tests to pass manually before I set up debian/tests). Once set up this is what autopkgtest would normally be configured to do, run pytest-3 from the source dir [more precisely, it copies the src to a tmpdir and launches from there]. Other, more specific, test configurations or test commands can be used if needed.
Debian source for pytest itself is https://salsa.debian.org/python-team/modules/pytest . There are some patches but no bug reports to indicate they're causing problems.
Ok, I've dug into what's happening on https://github.com/aragilar/pytest-mpi/blob/master/tests/conftest.py#L44, it seems that for some reason the user site packages are not being picked up correctly (I think somewhere pytest is changing the environment to do that within its testdir setup). Possibly pytest-mpi may be working now with the src dir (at least when I used the system pytest, moving to src seemed to fix that on my system), but running the tests with pytest-mpi in the user site packages seems to be still failing.
Also, would you prefer me tagging v0.4 now, and try to fix this later, or hold off tagging v0.4 until this is fixed?
The other thing is to ensure that -p pytester
is included in the pytest cli, as pytester (pytest test logic) isn't included otherwise.
Probably best to hold off 0.4 until this is fixed I figure, if pytest-3 is supposed to work (without specifying -p pytester
) from the src dir. Unless it's going to time some time to fix, in which case follow your preferred schedule.
In any case, you've just given the practical workaround I need for autopkgtest. pytest-3 -p pytester
works just fine for me, I can use that in debian/tests. I didn't realise -p pytester
was the key.
So possibly this isn't actually a bug, if -p pytester
should always be given explicitly. That could be fair enough, "who tests the tester?".
But do put in the documentation somewhere that -p pytester
is needed when invoking pytest!
Running pytest-mpi's tests using pytest fails, with two types of error found:
This is on Debian unstable with pytest 4.6.9.
Full log: