Debian Codegraph @

debian/patches/0001-Make-the-test-suite-support-Debian-as-installed-test.patch

raw
1 Subject: [PATCH] Make the test suite support Debian as-installed testing ("autopkgtest")
2 Bug-Debian: https://bugs.debian.org/765167
3 Forwarded: not-needed
4 From: Florian Schlichting <[email protected]>
5 Last-Update: 2026-04-24
6
7 When running as-installed tests, the module gets loaded from the system
8 paths. As-installed testing is detected by the existence of the AUTOPKGTEST_TMP
9 environment variable.
10
11 As we no longer ship a RangeMessage.xml in the package, disable the
12 included_range_message test. However env_range_message works well with
13 our smoke-files. Skip renaming files in blib, which are not present in
14 the testbed.
15
16 Extended similarly to new tests on 2024-03-09.
17
18
19 ---
20 t/check_data_structure.t | 9 +++++++--
21 1 file changed, 7 insertions(+), 2 deletions(-)
22
23 --- a/t/check_data_structure.t
24 +++ b/t/check_data_structure.t
25 @@ -10,6 +10,7 @@
26 };
27
28 subtest 'included_range_message' => sub {
29 + plan skip_all => "Debian doesn't include a RangeMessage.xml that could be tested here" if $ENV{AUTOPKGTEST_TMP};
30 # Test with included RangeMessage.xml in the same spot as the module
31 like( $Business::ISBN::country_data{_source}, qr/RangeMessage\.xml/ );
32 like( $Business::ISBN::country_data{_source}, qr/blib/ );
33 @@ -55,14 +56,14 @@
34 my $file = catfile( qw(blib lib Business ISBN RangeMessage.xml) );
35 my $out_of_the_way = $file . '.hidden';
36
37 - rename $file => $out_of_the_way;
38 + rename $file => $out_of_the_way unless $ENV{AUTOPKGTEST_TMP};
39
40 ok( ! -e $file, 'RangeMessage.xml is out of the way' );
41 local %Business::ISBN::country_data = Business::ISBN::Data::_get_data();
42
43 like( $Business::ISBN::country_data{_source}, qr/\bData\.pm/, 'Data source is the default data structure' );
44
45 - rename $out_of_the_way => $file;
46 + rename $out_of_the_way => $file unless $ENV{AUTOPKGTEST_TMP};
47 };
48
49 subtest 'default_data' => sub {
50 --- a/t/default_data.t
51 +++ b/t/default_data.t
52 @@ -29,7 +29,7 @@
53 my $file = catfile( qw(blib lib Business ISBN RangeMessage.xml) );
54 my $out_of_the_way = $file . '.hidden';
55
56 - ok( rename($file => $out_of_the_way), 'Renamed file' );
57 + ok( rename($file => $out_of_the_way), 'Renamed file' ) unless $ENV{AUTOPKGTEST_TMP};
58
59 subtest 'compile' => sub {
60 my @modules = qw( Business::ISBN::Data );
61 @@ -48,7 +48,7 @@
62 }
63 };
64
65 - rename $out_of_the_way => $file;
66 + rename $out_of_the_way => $file unless $ENV{AUTOPKGTEST_TMP};
67 }
68
69 done_testing();
70 --- a/t/business-isbn.t
71 +++ b/t/business-isbn.t
72 @@ -13,7 +13,10 @@
73
74 subtest 'source' => sub {
75 ok exists $Business::ISBN::country_data{'_source'}, 'country_data has _source';
76 + SKIP: {
77 + skip "No RangeMessage.xml in installed package", 1 if $ENV{AUTOPKGTEST_TMP};
78 like $Business::ISBN::country_data{'_source'}, qr/RangeMessage\.xml/, 'source is RangeMessage';
79 + }
80 is Business::ISBN::isbn_data_source(), $Business::ISBN::country_data{'_source'}, 'isbn_data_source returns _source';
81
82 delete local $Business::ISBN::country_data{'_source'};
83 --- a/t/get_data.t
84 +++ b/t/get_data.t
85 @@ -27,11 +27,15 @@
86 local $ENV{$KEY} = $file;
87
88 my %data = Business::ISBN::Data->_get_data();
89 + SKIP: {
90 + skip "No RangeMessage.xml in installed package", 1 if $ENV{AUTOPKGTEST_TMP};
91 + }
92 ok exists $data{'_source'}, '_source exists in hash';
93 is $data{'_source'}, $file, '_source is the file';
94 };
95
96 subtest 'ISBN_RANGE_MESSAGE file does not exist' => sub {
97 + plan skip_all => "Debian doesn't include a RangeMessage.xml that could be tested here" if $ENV{AUTOPKGTEST_TMP};
98 my $file = 'lib/Business/ISBN/RangeMessage.yaml';
99 ok ! -e $file, "$file does not exist";
100 local $ENV{$KEY} = $file;