From c0d144f9fed223031387d7d4147f32fdfa7fd0c8 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sun, 12 May 2024 11:20:45 +0200 Subject: [PATCH] move MetaCPAN::Web::Test to t/lib MetaCPAN::Web::Test is only used by the tests, so it should be in the test libraries. Also consistently load from t/lib in all tests. --- t/assets.t | 2 ++ t/controller/about.t | 2 ++ t/controller/account.t | 14 ++++++++------ t/controller/activity.t | 2 ++ t/controller/author.t | 2 ++ t/controller/changes.t | 1 + t/controller/contributing-to.t | 2 ++ t/controller/diff.t | 2 ++ t/controller/favorite/leaderboard.t | 2 ++ t/controller/feed.t | 1 + t/controller/home.t | 2 ++ t/controller/lab/dashboard.t | 2 ++ t/controller/permission.t | 2 ++ t/controller/pod.t | 2 ++ t/controller/raw.t | 2 ++ t/controller/recent.t | 2 ++ t/controller/release.t | 2 ++ t/controller/robots.t | 2 ++ t/controller/search.t | 2 ++ t/controller/search/autocomplete.t | 4 +++- t/controller/search/precision.t | 2 ++ t/controller/search/suggestion.t | 2 ++ t/controller/shared/release-info.t | 2 ++ t/controller/source.t | 2 ++ t/encoding.t | 3 ++- t/fastly_headers.t | 2 ++ t/html.t | 1 + {lib => t/lib}/MetaCPAN/Web/Test.pm | 0 .../lib}/MetaCPAN/Web/Test/HTML5/Element/SVG.pm | 0 .../lib}/MetaCPAN/Web/Test/HTML5/TreeBuilder.pm | 0 t/markdown.t | 2 ++ t/model/api/lab.t | 1 + t/model/changes-tests/read_dbix-class.t | 2 ++ t/model/changes-tests/read_moose.t | 2 ++ t/model/changes.t | 1 + t/model/permission.t | 1 + t/model/release-info.t | 1 + t/model/release.t | 1 + t/moose.t | 1 + t/session.t | 2 ++ t/static-files.t | 1 + t/tidyall.t | 3 +-- t/view/json.t | 1 + 43 files changed, 75 insertions(+), 10 deletions(-) rename {lib => t/lib}/MetaCPAN/Web/Test.pm (100%) rename {lib => t/lib}/MetaCPAN/Web/Test/HTML5/Element/SVG.pm (100%) rename {lib => t/lib}/MetaCPAN/Web/Test/HTML5/TreeBuilder.pm (100%) diff --git a/t/assets.t b/t/assets.t index ec0f4e0949..7456b8a5a3 100644 --- a/t/assets.t +++ b/t/assets.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/about.t b/t/controller/about.t index b8a0fb6268..276eea8641 100644 --- a/t/controller/about.t +++ b/t/controller/about.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_cache_headers test_psgi ); diff --git a/t/controller/account.t b/t/controller/account.t index 47e814c8c1..2e14a88c28 100644 --- a/t/controller/account.t +++ b/t/controller/account.t @@ -1,12 +1,14 @@ use strict; use warnings; -use MetaCPAN::Web::Test qw( app GET override_api_response POST test_psgi tx ); +use lib 't/lib'; + use Test::More; -use Test::Deep qw( cmp_deeply ); -use Cpanel::JSON::XS qw( decode_json ); -use HTTP::Date qw( time2str ); -use HTTP::Cookies (); -use Plack::Session (); +use MetaCPAN::Web::Test qw( app GET override_api_response POST test_psgi tx ); +use Test::Deep qw( cmp_deeply ); +use Cpanel::JSON::XS qw( decode_json ); +use HTTP::Date qw( time2str ); +use HTTP::Cookies (); +use Plack::Session (); my $api_res; my $api_req; diff --git a/t/controller/activity.t b/t/controller/activity.t index a760033415..d167321900 100644 --- a/t/controller/activity.t +++ b/t/controller/activity.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/author.t b/t/controller/author.t index a6bf5bf99c..aba5f23c2c 100644 --- a/t/controller/author.t +++ b/t/controller/author.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/changes.t b/t/controller/changes.t index 891411367f..c6c1a6ebed 100644 --- a/t/controller/changes.t +++ b/t/controller/changes.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/contributing-to.t b/t/controller/contributing-to.t index 7c4750a5aa..a36c98deaa 100644 --- a/t/controller/contributing-to.t +++ b/t/controller/contributing-to.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/diff.t b/t/controller/diff.t index ce2e6cfd47..64d0699976 100644 --- a/t/controller/diff.t +++ b/t/controller/diff.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/favorite/leaderboard.t b/t/controller/favorite/leaderboard.t index 1761ef03b4..eb8f3fc64d 100644 --- a/t/controller/favorite/leaderboard.t +++ b/t/controller/favorite/leaderboard.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/feed.t b/t/controller/feed.t index 9abb24f2e9..1aa7d675aa 100644 --- a/t/controller/feed.t +++ b/t/controller/feed.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use MetaCPAN::Web (); use MetaCPAN::Web::Controller::Feed (); diff --git a/t/controller/home.t b/t/controller/home.t index 746443e957..68e5e2b007 100644 --- a/t/controller/home.t +++ b/t/controller/home.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_cache_headers test_psgi ); diff --git a/t/controller/lab/dashboard.t b/t/controller/lab/dashboard.t index 14cdd3ebf9..510af16812 100644 --- a/t/controller/lab/dashboard.t +++ b/t/controller/lab/dashboard.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi ); diff --git a/t/controller/permission.t b/t/controller/permission.t index bb41d0f6b9..d0ddd67d80 100644 --- a/t/controller/permission.t +++ b/t/controller/permission.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi ); diff --git a/t/controller/pod.t b/t/controller/pod.t index 3f52df6ef7..ce07fea92a 100644 --- a/t/controller/pod.t +++ b/t/controller/pod.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/raw.t b/t/controller/raw.t index 80ca0dae85..ed9aa81d1b 100644 --- a/t/controller/raw.t +++ b/t/controller/raw.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/recent.t b/t/controller/recent.t index 9ea4c5b945..4cc4660fc8 100644 --- a/t/controller/recent.t +++ b/t/controller/recent.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/release.t b/t/controller/release.t index 53ec9489d4..0131037c44 100644 --- a/t/controller/release.t +++ b/t/controller/release.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/robots.t b/t/controller/robots.t index bf788ddb93..bfbaa2b0a9 100644 --- a/t/controller/robots.t +++ b/t/controller/robots.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_cache_headers test_psgi ); diff --git a/t/controller/search.t b/t/controller/search.t index e44fec4fac..1bb99a7f7d 100644 --- a/t/controller/search.t +++ b/t/controller/search.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); use Encode qw( encode is_utf8 ); diff --git a/t/controller/search/autocomplete.t b/t/controller/search/autocomplete.t index be047298a5..f4133830f8 100644 --- a/t/controller/search/autocomplete.t +++ b/t/controller/search/autocomplete.t @@ -1,7 +1,9 @@ use strict; use warnings; -use Encode qw( encode is_utf8 ); +use lib 't/lib'; + use Test::More; +use Encode qw( encode is_utf8 ); use MetaCPAN::Web::Test qw( app GET test_psgi ); use Cpanel::JSON::XS qw( decode_json ); diff --git a/t/controller/search/precision.t b/t/controller/search/precision.t index f9e613a299..4bab70f3ff 100644 --- a/t/controller/search/precision.t +++ b/t/controller/search/precision.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/search/suggestion.t b/t/controller/search/suggestion.t index 52b9d3c04a..e5003b5fca 100644 --- a/t/controller/search/suggestion.t +++ b/t/controller/search/suggestion.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/shared/release-info.t b/t/controller/shared/release-info.t index f54bbd8c5b..c6909867d8 100644 --- a/t/controller/shared/release-info.t +++ b/t/controller/shared/release-info.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More 0.96; use MetaCPAN::Web::Test qw( app GET test_psgi tx ); diff --git a/t/controller/source.t b/t/controller/source.t index 5a49454aea..f96d575bf3 100644 --- a/t/controller/source.t +++ b/t/controller/source.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_cache_headers test_psgi tx ); diff --git a/t/encoding.t b/t/encoding.t index 52d54ae241..90eb37fad7 100644 --- a/t/encoding.t +++ b/t/encoding.t @@ -1,6 +1,7 @@ -# vim: set ts=2 sts=2 sw=2 expandtab smarttab: use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( override_api_response ); use Encode qw( encode is_utf8 ); diff --git a/t/fastly_headers.t b/t/fastly_headers.t index 9758a33c79..ad121237b8 100644 --- a/t/fastly_headers.t +++ b/t/fastly_headers.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app GET test_psgi ); diff --git a/t/html.t b/t/html.t index eeca69289f..bbb5d1f04f 100644 --- a/t/html.t +++ b/t/html.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; diff --git a/lib/MetaCPAN/Web/Test.pm b/t/lib/MetaCPAN/Web/Test.pm similarity index 100% rename from lib/MetaCPAN/Web/Test.pm rename to t/lib/MetaCPAN/Web/Test.pm diff --git a/lib/MetaCPAN/Web/Test/HTML5/Element/SVG.pm b/t/lib/MetaCPAN/Web/Test/HTML5/Element/SVG.pm similarity index 100% rename from lib/MetaCPAN/Web/Test/HTML5/Element/SVG.pm rename to t/lib/MetaCPAN/Web/Test/HTML5/Element/SVG.pm diff --git a/lib/MetaCPAN/Web/Test/HTML5/TreeBuilder.pm b/t/lib/MetaCPAN/Web/Test/HTML5/TreeBuilder.pm similarity index 100% rename from lib/MetaCPAN/Web/Test/HTML5/TreeBuilder.pm rename to t/lib/MetaCPAN/Web/Test/HTML5/TreeBuilder.pm diff --git a/t/markdown.t b/t/markdown.t index b5e5beab63..b58db68b11 100644 --- a/t/markdown.t +++ b/t/markdown.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::RenderUtil qw( render_markdown ); diff --git a/t/model/api/lab.t b/t/model/api/lab.t index a35ebc923d..12b2687b39 100644 --- a/t/model/api/lab.t +++ b/t/model/api/lab.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; use MetaCPAN::Web (); diff --git a/t/model/changes-tests/read_dbix-class.t b/t/model/changes-tests/read_dbix-class.t index 85042aa9f4..ed34ce274a 100644 --- a/t/model/changes-tests/read_dbix-class.t +++ b/t/model/changes-tests/read_dbix-class.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use aliased 'MetaCPAN::Web::Model::API::Changes::Parser'; diff --git a/t/model/changes-tests/read_moose.t b/t/model/changes-tests/read_moose.t index 2deab75eb6..e9279c76e1 100644 --- a/t/model/changes-tests/read_moose.t +++ b/t/model/changes-tests/read_moose.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use aliased 'MetaCPAN::Web::Model::API::Changes::Parser'; diff --git a/t/model/changes.t b/t/model/changes.t index 9e95b770fe..a5e8541d4a 100644 --- a/t/model/changes.t +++ b/t/model/changes.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; diff --git a/t/model/permission.t b/t/model/permission.t index a2cbc46d15..c1c358bfbf 100644 --- a/t/model/permission.t +++ b/t/model/permission.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; use MetaCPAN::Web (); diff --git a/t/model/release-info.t b/t/model/release-info.t index 6deb29ebc2..283c3457e9 100644 --- a/t/model/release-info.t +++ b/t/model/release-info.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; use Module::Runtime qw( use_module ); diff --git a/t/model/release.t b/t/model/release.t index c5dd0f2ce9..cf3bcbc6c7 100644 --- a/t/model/release.t +++ b/t/model/release.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; use Cpanel::JSON::XS qw( decode_json ); diff --git a/t/moose.t b/t/moose.t index e581c9e221..43b3b5646d 100644 --- a/t/moose.t +++ b/t/moose.t @@ -1,6 +1,7 @@ use strict; use warnings; use lib 't/lib'; + use Test::More; use File::Find (); # core use Module::Runtime (); diff --git a/t/session.t b/t/session.t index ce74c1df07..2b7ca1622f 100644 --- a/t/session.t +++ b/t/session.t @@ -1,5 +1,7 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More; use MetaCPAN::Web::Test qw( app test_psgi ); use URI::Escape (); diff --git a/t/static-files.t b/t/static-files.t index 51b44f6867..6c8920b592 100644 --- a/t/static-files.t +++ b/t/static-files.t @@ -1,5 +1,6 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; use Digest::SHA (); diff --git a/t/tidyall.t b/t/tidyall.t index 23584ae567..172f0c7137 100755 --- a/t/tidyall.t +++ b/t/tidyall.t @@ -1,7 +1,6 @@ -#!/usr/bin/env perl - use strict; use warnings; +use lib 't/lib'; # This test is _really_ slow with Devel::Cover running. Also, # there's really no reason to run this when coverage tests are running, since diff --git a/t/view/json.t b/t/view/json.t index 0d1531f33f..ce0d7d5960 100644 --- a/t/view/json.t +++ b/t/view/json.t @@ -1,6 +1,7 @@ use strict; use warnings; use lib 't/lib'; + use Test::More; use HTTP::Request::Common qw( POST ); use MetaCPAN::Web::Test qw( app test_psgi );