On Sun, Jan 16, 2022 at 05:33:14AM -0800, Felix Lechner wrote: > Hi, > > On Sun, Jan 16, 2022 at 2:27 AM Julian Gilbey <j...@debian.org> wrote: > > > > *If* the consensus is that py3versions -r is wrong, then we should > > probably have a lintian check for it: py3versions -r (and variants > > such as -rv and -vr) without a corresponding X-Python3-Version field > > should give a lintian warning, and py3versions -s with an > > X-Python3-Version field should do so likewise. > > For reference, here is Lintian's current code examining the use of > 'py3versions' in tests. [1] > > Kind regards > Felix Lechner > > [1] > https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Testsuite.pm#L289-309
Thanks Felix, that's really helpful! So perhaps another clause or two, something along the lines of the following, would be good? (This is not working code; I don't know all the ins and outs of lintian's library to make it work. Also, these should probably be warnings rather than hints.) $x_python3_depend_field_present = [boolean specifying whether X-Python3-Depend field is present in debian/control]; $self->pointed_hint( 'runtime-test-file-uses-requested-python-versions-without-x-python3-depend', $pointer, $command ) if $options =~ /\s(?:-\w*r|--requested)/ && !$x_python3_depend_field_present; $self->pointed_hint( 'runtime-test-file-uses-supported-python-versions-with-x-python3-depend', $pointer, $command ) if $options =~ /\s(?:-\w*s|--supported)/ && $x_python3_depend_field_present; There are obviously still a bunch of debian/test/* files which have different options: * some use -d (which does make sense, but may not be the best thing to do in a debian/test/* file, as it will miss advanced warning of breakages on newer versions of python) * some use -i (which is picked up by the existing tests) * lots use -r (see earlier discussion) * lots use -s (which is generally fine), though some of these also use 2>/dev/null, which is not a good idea And a couple don't follow the standard coding pattern: * tap.py 3.1-1 has: : ${PYVERSIONS:=py3versions} for python in $($PYVERSIONS --supported); do I'm unclear what is gained by thinking that the environment might override PYVERSIONS. * csound 6.16.2~dfsg-1 has: # By default, test on all versions versions="-r" if [ "$2" = default ] ; then versions="-d" fi for py in $(py3versions $versions 2>/dev/null) ; do Finally, confget 4.1.0-1 tests for the presence of py3versions before using it, which is just unnecessary (but thankfully doesn't mess up the existing lintian test). Best wishes, Julian