Felix Lechner pushed to branch master at lintian / lintian
Commits:
-
7cea4d32
by Louis-Philippe Véronneau at 2022-01-19T15:43:44-08:00
7 changed files:
- lib/Lintian/Check/Testsuite.pm
- + t/recipes/checks/testsuite/should-query-all-python-versions/build-spec/debian/tests/control
- + t/recipes/checks/testsuite/should-query-all-python-versions/build-spec/debian/tests/some-python
- + t/recipes/checks/testsuite/should-query-all-python-versions/build-spec/fill-values
- + t/recipes/checks/testsuite/should-query-all-python-versions/eval/desc
- + t/recipes/checks/testsuite/should-query-all-python-versions/eval/hints
- + tags/t/test-leaves-python-version-untested.tag
Changes:
... | ... | @@ -275,6 +275,13 @@ sub check_test_file { |
275 | 275 |
return
|
276 | 276 |
unless $item->is_open_ok;
|
277 | 277 |
|
278 |
+ my $debian_control = $self->processable->debian_control;
|
|
279 |
+ |
|
280 |
+ my $depends_norestriction = Lintian::Relation->new;
|
|
281 |
+ $depends_norestriction->load($section->unfolded_value('Depends'));
|
|
282 |
+ |
|
283 |
+ my $queries_all_python_versions = 0;
|
|
284 |
+ |
|
278 | 285 |
open(my $fd, '<', $item->unpacked_path)
|
279 | 286 |
or die encode_utf8('Cannot open ' . $item->unpacked_path);
|
280 | 287 |
|
... | ... | @@ -296,9 +303,6 @@ sub check_test_file { |
296 | 303 |
$pointer, $command)
|
297 | 304 |
if $options =~ /\s(?:-\w*i|--installed)/;
|
298 | 305 |
|
299 |
- my $depends_norestriction = Lintian::Relation->new;
|
|
300 |
- $depends_norestriction->load($section->unfolded_value('Depends'));
|
|
301 |
- |
|
302 | 306 |
$self->pointed_hint(
|
303 | 307 |
'runtime-test-file-uses-supported-python-versions-without-test-depends',
|
304 | 308 |
$pointer,
|
... | ... | @@ -307,8 +311,6 @@ sub check_test_file { |
307 | 311 |
if $options =~ /\s(?:-\w*s|--supported)/
|
308 | 312 |
&& !$depends_norestriction->satisfies($PYTHON3_ALL_DEPEND);
|
309 | 313 |
|
310 |
- my $debian_control = $self->processable->debian_control;
|
|
311 |
- |
|
312 | 314 |
$self->pointed_hint('declare-python-versions-for-test',
|
313 | 315 |
$pointer, $command)
|
314 | 316 |
if $options =~ m{ \s (?: -\w*r | --requested ) }x
|
... | ... | @@ -320,6 +322,9 @@ sub check_test_file { |
320 | 322 |
$debian_control->source_fields->value('X-Python3-Version'))
|
321 | 323 |
if $options =~ m{ \s (?: -\w*s | --supported ) }x
|
322 | 324 |
&& $debian_control->source_fields->declares('X-Python3-Version');
|
325 |
+ |
|
326 |
+ $queries_all_python_versions = 1
|
|
327 |
+ if $options =~ m{ \s (?: -\w*s | --supported ) }x;
|
|
323 | 328 |
}
|
324 | 329 |
|
325 | 330 |
} continue {
|
... | ... | @@ -328,6 +333,10 @@ sub check_test_file { |
328 | 333 |
|
329 | 334 |
close $fd;
|
330 | 335 |
|
336 |
+ $self->pointed_hint('test-leaves-python-version-untested',$item->pointer)
|
|
337 |
+ if $depends_norestriction->satisfies($PYTHON3_ALL_DEPEND)
|
|
338 |
+ && !$queries_all_python_versions;
|
|
339 |
+ |
|
331 | 340 |
return;
|
332 | 341 |
}
|
333 | 342 |
|
1 |
+Tests: some-python
|
|
2 |
+Depends: python3-all
|
1 |
+#!/bin/sh
|
|
2 |
+set -efu
|
|
3 |
+ |
|
4 |
+cp -a tests "$AUTOPKGTEST_TMP"
|
|
5 |
+cd "$AUTOPKGTEST_TMP"
|
|
6 |
+ |
|
7 |
+python3 -m unittest tests -v
|
1 |
+Skeleton: source-native
|
|
2 |
+Testname: should-query-all-python-versions
|
|
3 |
+Description: Autopkgtest depends on python3-all but does not invoke 'py3versions --supported'
|
1 |
+Testname: should-query-all-python-versions
|
|
2 |
+Check: testsuite
|
1 |
+should-query-all-python-versions (source): test-leaves-python-version-untested [debian/tests/some-python]
|
1 |
+Tag: test-leaves-python-version-untested
|
|
2 |
+Severity: warning
|
|
3 |
+Check: testsuite
|
|
4 |
+Explanation: The named autopkgtest declares <code>python3-all</code> or an equivalent
|
|
5 |
+ as a runtime prerquisite but the test script does not query the installed Python
|
|
6 |
+ versions with <code>py3versions --supported</code>.
|
|
7 |
+ .
|
|
8 |
+ The test may pass with the standard Python version but could fail in the future with
|
|
9 |
+ a Python version that is already available now.
|
|
10 |
+ .
|
|
11 |
+ It is best to run tests for all available Python versions.
|