Bugzilla – Attachment 184364 Details for
Bug 40444
Add a test to ensure all Perl test files use Test::NoWarnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings
Bug-40444-Add-a-test-to-ensure-all-Perl-test-files.patch (text/plain), 11.47 KB, created by
Jonathan Druart
on 2025-07-18 12:15:27 UTC
(
hide
)
Description:
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-18 12:15:27 UTC
Size:
11.47 KB
patch
obsolete
>From 39240b8b42e11c1eeceaba86ee89fc9155c475db Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 18 Jul 2025 11:57:57 +0200 >Subject: [PATCH] Bug 40444: Add a test to ensure all Perl test files use > Test::NoWarnings > >This patch adds a new xt test (xt/use-test-no-warnings.t) to make sure >all our Perl test files will use Test::NoWarnings. > >It also adds Test::NoWarnings to some files that were missing it and >that didn't need any other changes. > >However we still have 7 non-trivial tests that we will consider >exception for now, until they are fixed. > >Test plan: > prove xt/use-test-no-warnings.t >should return green. >And all other tests modified by this patch (the qa script will do that >for you) > >You can also test the 2 selenium tests: >1. DROP and CREATE the DB > DROP DATABASE koha_kohadev; > CREATE DATABASE koha_kohadev; > restart_all >2. KOHA_TESTING=1 prove t/db_dependent/selenium/00-onboarding.t >3. Repeat 1 >2. KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t >--- > t/Koha/Plugins/HtmlScrubber.t | 3 +- > t/db_dependent/AuthorisedValues.t | 3 +- > t/db_dependent/Koha/Acquisition/Booksellers.t | 3 +- > t/db_dependent/Koha/Auth/TwoFactorAuth.t | 3 +- > t/db_dependent/Koha/Authority.t | 3 +- > t/db_dependent/Koha/BackgroundJob.t | 3 +- > t/db_dependent/Koha/Encryption.t | 3 +- > .../Koha/ILL/Request/Workflow/ConfirmAuto.t | 3 +- > .../Koha/ILL/Request/Workflow/HistoryCheck.t | 3 +- > t/db_dependent/Koha/Plugins/ILL/Backends.t | 3 +- > t/db_dependent/Koha/Plugins/Overdues.t | 3 +- > t/db_dependent/Koha/Pseudonymization.t | 3 +- > .../Koha/REST/Plugin/Auth/PublicRoutes.t | 3 +- > t/db_dependent/Patron/Borrower_Discharge.t | 3 +- > t/db_dependent/misc/translator/xgettext.pl.t | 3 +- > t/db_dependent/mojo/rest-auth.t | 3 +- > t/db_dependent/selenium/00-onboarding.t | 3 +- > t/db_dependent/selenium/01-installation.t | 3 +- > t/db_dependent/selenium/opac_ill_requests.t | 3 +- > xt/use-test-no-warnings.t | 54 +++++++++++++++++++ > 20 files changed, 92 insertions(+), 19 deletions(-) > create mode 100755 xt/use-test-no-warnings.t > >diff --git a/t/Koha/Plugins/HtmlScrubber.t b/t/Koha/Plugins/HtmlScrubber.t >index 33b4b6f1b58..046522ff8df 100755 >--- a/t/Koha/Plugins/HtmlScrubber.t >+++ b/t/Koha/Plugins/HtmlScrubber.t >@@ -17,7 +17,8 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; > use Template; > > subtest 'test scrubbing using default scrubber' => sub { >diff --git a/t/db_dependent/AuthorisedValues.t b/t/db_dependent/AuthorisedValues.t >index 559cd2ec74a..069614504ab 100755 >--- a/t/db_dependent/AuthorisedValues.t >+++ b/t/db_dependent/AuthorisedValues.t >@@ -1,7 +1,8 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 17; >+use Test::More tests => 18; >+use Test::NoWarnings; > use Test::Exception; > use Try::Tiny; > >diff --git a/t/db_dependent/Koha/Acquisition/Booksellers.t b/t/db_dependent/Koha/Acquisition/Booksellers.t >index e65e01fcefb..b104f128e11 100755 >--- a/t/db_dependent/Koha/Acquisition/Booksellers.t >+++ b/t/db_dependent/Koha/Acquisition/Booksellers.t >@@ -18,7 +18,8 @@ > use Modern::Perl; > > use utf8; >-use Test::More tests => 8; >+use Test::More tests => 9; >+use Test::NoWarnings; > > use t::lib::TestBuilder; > >diff --git a/t/db_dependent/Koha/Auth/TwoFactorAuth.t b/t/db_dependent/Koha/Auth/TwoFactorAuth.t >index 10e7e9af2c2..e0bee6c4656 100755 >--- a/t/db_dependent/Koha/Auth/TwoFactorAuth.t >+++ b/t/db_dependent/Koha/Auth/TwoFactorAuth.t >@@ -1,7 +1,8 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 3; >+use Test::More tests => 4; >+use Test::NoWarnings; > use Test::Exception; > use Test::MockModule; > >diff --git a/t/db_dependent/Koha/Authority.t b/t/db_dependent/Koha/Authority.t >index da9ec4fcb9a..714f1fc3db4 100755 >--- a/t/db_dependent/Koha/Authority.t >+++ b/t/db_dependent/Koha/Authority.t >@@ -19,7 +19,8 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; >+use Test::NoWarnings; > > use C4::AuthoritiesMarc; > use Koha::Authorities; >diff --git a/t/db_dependent/Koha/BackgroundJob.t b/t/db_dependent/Koha/BackgroundJob.t >index 035823d6f73..9b52d012934 100755 >--- a/t/db_dependent/Koha/BackgroundJob.t >+++ b/t/db_dependent/Koha/BackgroundJob.t >@@ -19,7 +19,8 @@ use Modern::Perl; > use utf8; > use Encode; > >-use Test::More tests => 6; >+use Test::More tests => 7; >+use Test::NoWarnings; > use Test::MockModule; > use Test::Exception; > use Test::Warn; >diff --git a/t/db_dependent/Koha/Encryption.t b/t/db_dependent/Koha/Encryption.t >index eee199404e2..413a498e9f9 100755 >--- a/t/db_dependent/Koha/Encryption.t >+++ b/t/db_dependent/Koha/Encryption.t >@@ -1,6 +1,7 @@ > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; > use Test::Exception; > use t::lib::Mocks; > use Koha::Encryption; >diff --git a/t/db_dependent/Koha/ILL/Request/Workflow/ConfirmAuto.t b/t/db_dependent/Koha/ILL/Request/Workflow/ConfirmAuto.t >index bb9315df0f0..8e3ca873878 100755 >--- a/t/db_dependent/Koha/ILL/Request/Workflow/ConfirmAuto.t >+++ b/t/db_dependent/Koha/ILL/Request/Workflow/ConfirmAuto.t >@@ -17,7 +17,8 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; >+use Test::NoWarnings; > > use Test::MockModule; > use Test::MockObject; >diff --git a/t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t b/t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t >index 604f270f0fd..1af24382a36 100755 >--- a/t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t >+++ b/t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t >@@ -17,7 +17,8 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; > > use Test::MockModule; > use Test::MockObject; >diff --git a/t/db_dependent/Koha/Plugins/ILL/Backends.t b/t/db_dependent/Koha/Plugins/ILL/Backends.t >index 992677ce6e0..e526d3aa0dc 100755 >--- a/t/db_dependent/Koha/Plugins/ILL/Backends.t >+++ b/t/db_dependent/Koha/Plugins/ILL/Backends.t >@@ -16,7 +16,8 @@ > > use Modern::Perl; > use File::Basename; >-use Test::More tests => 4; >+use Test::More tests => 5; >+use Test::NoWarnings; > > use t::lib::Mocks; > use t::lib::TestBuilder; >diff --git a/t/db_dependent/Koha/Plugins/Overdues.t b/t/db_dependent/Koha/Plugins/Overdues.t >index d044817c176..3e020bd20d2 100755 >--- a/t/db_dependent/Koha/Plugins/Overdues.t >+++ b/t/db_dependent/Koha/Plugins/Overdues.t >@@ -16,7 +16,8 @@ > > use Modern::Perl; > >-use Test::More tests => 8; >+use Test::More tests => 9; >+use Test::NoWarnings; > use Test::Warn; > > use C4::Overdues qw(CalcFine); >diff --git a/t/db_dependent/Koha/Pseudonymization.t b/t/db_dependent/Koha/Pseudonymization.t >index ca3461c119b..dbefe2652b2 100755 >--- a/t/db_dependent/Koha/Pseudonymization.t >+++ b/t/db_dependent/Koha/Pseudonymization.t >@@ -19,7 +19,8 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; >+use Test::NoWarnings; > use Test::Warn; > use Try::Tiny; > >diff --git a/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t b/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t >index 991a8c15977..4e5b571073a 100755 >--- a/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t >+++ b/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t >@@ -71,7 +71,8 @@ post '/public_guarantor' => sub { > } > }; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; > use Test::Mojo; > > use t::lib::Mocks; >diff --git a/t/db_dependent/Patron/Borrower_Discharge.t b/t/db_dependent/Patron/Borrower_Discharge.t >index 869ccc18c18..0f42c5cad5b 100755 >--- a/t/db_dependent/Patron/Borrower_Discharge.t >+++ b/t/db_dependent/Patron/Borrower_Discharge.t >@@ -16,7 +16,8 @@ > > use Modern::Perl; > >-use Test::More tests => 32; >+use Test::More tests => 33; >+use Test::NoWarnings; > > use Test::MockModule; > use Test::Warn; >diff --git a/t/db_dependent/misc/translator/xgettext.pl.t b/t/db_dependent/misc/translator/xgettext.pl.t >index b6d2a4d1d3f..622c71dc538 100755 >--- a/t/db_dependent/misc/translator/xgettext.pl.t >+++ b/t/db_dependent/misc/translator/xgettext.pl.t >@@ -6,7 +6,8 @@ use File::Slurp; > use File::Temp qw(tempdir); > use FindBin qw($Bin); > use Locale::PO; >-use Test::More tests => 20; >+use Test::More tests => 21; >+use Test::NoWarnings; > > my $tempdir = tempdir( CLEANUP => 1 ); > >diff --git a/t/db_dependent/mojo/rest-auth.t b/t/db_dependent/mojo/rest-auth.t >index 75384b95f7e..4b9d5b60f56 100755 >--- a/t/db_dependent/mojo/rest-auth.t >+++ b/t/db_dependent/mojo/rest-auth.t >@@ -2,7 +2,8 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; > use Test::Mojo; > > use Koha::Database; >diff --git a/t/db_dependent/selenium/00-onboarding.t b/t/db_dependent/selenium/00-onboarding.t >index 8cad7a86dc3..61ee44c4714 100755 >--- a/t/db_dependent/selenium/00-onboarding.t >+++ b/t/db_dependent/selenium/00-onboarding.t >@@ -22,7 +22,8 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; > > use t::lib::Selenium; > use C4::Context; >diff --git a/t/db_dependent/selenium/01-installation.t b/t/db_dependent/selenium/01-installation.t >index 7f0bc02690a..ba442117ca8 100755 >--- a/t/db_dependent/selenium/01-installation.t >+++ b/t/db_dependent/selenium/01-installation.t >@@ -22,7 +22,8 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; > > use t::lib::Selenium; > use C4::Context; >diff --git a/t/db_dependent/selenium/opac_ill_requests.t b/t/db_dependent/selenium/opac_ill_requests.t >index 20f1d49b3d3..88c0e98d62f 100755 >--- a/t/db_dependent/selenium/opac_ill_requests.t >+++ b/t/db_dependent/selenium/opac_ill_requests.t >@@ -16,7 +16,8 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 1; >+use Test::More tests => 2; >+use Test::NoWarnings; > > use C4::Biblio qw(DelBiblio); > >diff --git a/xt/use-test-no-warnings.t b/xt/use-test-no-warnings.t >new file mode 100755 >index 00000000000..c7ab9e6ca75 >--- /dev/null >+++ b/xt/use-test-no-warnings.t >@@ -0,0 +1,54 @@ >+#/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Test::More tests => 2; >+use Test::NoWarnings; >+ >+use Array::Utils qw( array_minus ); >+ >+my @t_files = qx{git grep --files-without-match "Test::NoWarnings" 't/*.t'}; >+chomp for @t_files; >+ >+my @exceptions = ( >+ >+ # Cannot be removed >+ "t/00-testcritic.t", >+ >+ # bug 40386 >+ "t/Edifact.t", >+ >+ # bug 40387 >+ "t/db_dependent/Koha/EDI.t", >+ >+ # bug 40382 >+ "t/db_dependent/Koha/CoverImages.t", >+ >+ # bug 40442 >+ "t/db_dependent/Koha/MarcOrder.t", >+ >+ # bug 40375 >+ "t/db_dependent/XISBN.t", >+ >+ # bug 40443 >+ "t/db_dependent/cronjobs/advance_notices_digest.t", >+); >+ >+@t_files = array_minus( @t_files, @exceptions ); >+is( scalar(@t_files), 0, "All Perl test files should contain Test::NoWarnings" ) >+ or diag( sprintf "The following test files should use Test::NoWarnings:\n\t%s", join "\n\t", @t_files ); >+ >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40444
:
184319
| 184364 |
184365