Project

General

Profile

Actions

action #99675

closed

Useless use of a constant ("can load python test module at a"...) in void context at ./08-autotest.t line 342.

Added by okurz about 3 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2021-10-01
Due date:
% Done:

0%

Estimated time:

Description

Observation

From https://github.com/os-autoinst/os-autoinst/pull/1794/checks?check_run_id=3767019262

8: Useless use of a constant ("can load python test module at a"...) in void context at ./08-autotest.t line 342.
8: [2021-10-01T12:26:58.267 UTC] [debug] scheduling test tests/test.py
8: [12:26:58] ./08-autotest.t .......................... ok     2413 ms ( 0.02 usr  0.00 sys +  2.17 cusr  0.14 csys =  2.33 CPU)

Acceptance criteria

  • AC1: No perl warning from 08-autotest.t in CI

Suggestions

In your os-autoinst working copy run locally, e.g. prove -I. t/08-autotest.t to reproduce

Actions #1

Updated by tinita about 3 years ago

the code:

pass autotest::loadtest('tests/test.py'), 'can load python test module at all';

But pass() always passes and only takes one argument.

Maybe you wanted ok autotest::...?
But this fails for me locally and in CI.

edit: When fixed, the test should also get a use Test::Warnings qw(:report_warnings); to prevent future warnings
@okurz since you introduced this in https://github.com/os-autoinst/os-autoinst/pull/1750 maybe you can say what the original intent was?

Actions #2

Updated by okurz about 3 years ago

  • Status changed from New to Feedback
  • Assignee set to okurz

ah, I get it then. "ok" does not work because loadtest does not return anything. I just wanted to check that we can pass the step of loadtest without crashing :D

Fixed in https://github.com/os-autoinst/os-autoinst/pull/1797

I tried to add Test::Warnings but did not succeed:

#   Failed test 'no (unexpected) warnings (via done_testing)'
#   at t/08-autotest.t line 350.
# Got the following unexpected warnings:
#   1: loadtest needs a script below t/fake - does/not/match is not
#   2: ERROR: no tests loaded at /home/okurz/local/os-autoinst/os-autoinst/autotest.pm line 339.
#   3: Subroutine run redefined at foo/tests/start.pm line 4.
# Looks like you failed 1 test of 94.

even though I don't see these warnings at all when not including Test::Warnings

Actions #3

Updated by tinita about 3 years ago

These warnings are hidden by stderr_like (which only checks that the given text is in stderr).
A warning will still be recorded, so I replaced stderr_like with like warning:

https://github.com/os-autoinst/os-autoinst/pull/1798

Actions #4

Updated by okurz about 3 years ago

  • Status changed from Feedback to Resolved
  • Assignee changed from okurz to tinita

merged as well. Awesome! thx

Actions

Also available in: Atom PDF