Closed Bug 663835 Opened 14 years ago Closed 14 years ago

Extensions templates are not tested by the normal sanity test scripts

Categories

(Bugzilla :: Extensions, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: dkl, Assigned: dkl)

Details

Attachments

(1 file, 2 obsolete files)

When certain sanity scripts are ran by runtests.pl such as 004template.t and 008filter.t, the templates in extensions/*/template are not tested. Patch coming that adds enabled extensions templates to the list to test. dkl
Assignee: extensions → dkl
Status: NEW → ASSIGNED
Attachment #538913 - Flags: review?(mkanat)
Comment on attachment 538913 [details] [diff] [review] Patch to enabled testing of extension templates (v1) Review of attachment 538913 [details] [diff] [review]: ----------------------------------------------------------------- This is awesome! I think there's one cleanup we should do, though: ::: t/Support/Templates.pm @@ +75,5 @@ > + foreach my $extension (@extensions) { > + $path = File::Spec->catdir($extension . '/template', $langdir, 'custom'); > + $dirs{$path} = 1 if -d $path; > + $path = File::Spec->catdir($extension . '/template', $langdir, 'default'); > + $dirs{$path} = 1 if -d $path; This should be using template_include_path instead of all of this custom code. (I know the previous code wasn't, but if we're going to be checking every template, this is a good time to start.)
Attachment #538913 - Flags: review?(mkanat) → review-
New patch with suggested changes. dkl
Attachment #538913 - Attachment is obsolete: true
Attachment #539326 - Flags: review?(mkanat)
Just a note that when this patch lands and any of the included extensions (Voting, OldBugMove, Example, etc.) are enabled on an installation, runtests.pl will throw errors that were not there before. I will open new bugs for each of those to fix separately. For example t/008filter.t will throw errors complaining that a filterexceptions.pl file does not exist for each of the extensions template dirs. Adding a clean filterexceptions.pl file to each then throws more errors about all of the vars in the templates that are not filtered. dkl
Comment on attachment 539326 [details] [diff] [review] Patch to enabled testing of extension templates (v1) Review of attachment 539326 [details] [diff] [review]: ----------------------------------------------------------------- ::: t/Support/Templates.pm @@ +62,5 @@ > # Scan for the template available languages and include paths > { > + foreach my $langdir (Bugzilla->languages) { > + my %dirs; > + my $paths = template_include_path({ language => [ $langdir ] }); I wonder, would it just be simpler to say: @include_paths = @{ template_include_path({ language => Bugzilla->languages }) }; That would also guarantee a consistent order (which keys %dirs doesn't). Then you could just do @languages = @{ Bugzilla->languages } for @languages. @@ +64,5 @@ > + foreach my $langdir (Bugzilla->languages) { > + my %dirs; > + my $paths = template_include_path({ language => [ $langdir ] }); > + foreach my $path (@$paths) { > + $dirs{$path} = 1 if -d $path; template_include_path already checks that for you; everything it returns is a valid directory. (See _template_lang_directories in Install::Util.)
Attachment #539326 - Flags: review?(mkanat) → review-
Thanks for the review. Here is a simplified patch that uses your suggestions. I had to also update t/004template.t to use @include_paths instead of the $include_path{$lang} colon delimited strings. Works well for me. dkl
Attachment #539326 - Attachment is obsolete: true
Attachment #541144 - Flags: review?(mkanat)
Comment on attachment 541144 [details] [diff] [review] Patch to enabled testing of extension templates (v2) Frickin beautiful. :-)
Attachment #541144 - Flags: review?(mkanat) → review+
Flags: approval+
Target Milestone: --- → Bugzilla 4.2
trunk: Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/trunk modified t/Support/Templates.pm modified t/004template.t Committed revision 7842. dkl
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: