Bug 9486 - t/Letters.t loads modules in wrong order
Summary: t/Letters.t loads modules in wrong order
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P5 - low blocker (vote)
Target Milestone: Oldversions
Assignee: Jared Camins-Esakov
QA Contact: Katrin Fischer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-24 18:49 UTC by Jared Camins-Esakov
Modified: 2018-12-16 19:31 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 9486: t/Letters.t loads modules in wrong order (1.28 KB, patch)
2013-01-24 18:59 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 9486: t/Letters.t loads modules in wrong order (1.34 KB, patch)
2013-01-24 19:10 UTC, Chris Cormack
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 9486: t/Letters.t loads modules in wrong order (1.43 KB, patch)
2013-01-24 19:39 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2013-01-24 18:49:47 UTC
Because the unit test t/Letters.t loads C4::Letters before C4::Context, and C4::Letters is not even vaguely thread-safe, the test tends to fail. Usually. Moving the dbh mocking to before the use_ok('C4::Letters') test fixes the problem.
Comment 1 Jared Camins-Esakov 2013-01-24 18:59:04 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2013-01-24 19:09:58 UTC
Before
1..2
DBD::mysql::db do failed: Unknown or incorrect time zone: 'Pacific/Auckland' at C4/Context.pm line 825, <DATA> line 429.
ok 1 - use C4::Letters;
not ok 2 - HASH ref of ISBN is book
#   Failed test 'HASH ref of ISBN is book'
#   at t/Letters.t line 36.
#          got: undef
#     expected: 'book'
# Looks like you failed 1 test of 2

After
1..2
Name "DBI::errstr" used only once: possible typo at t/Letters.t line 16.
ok 1 - use C4::Letters;
ok 2 - HASH ref of ISBN is boo
Comment 3 Chris Cormack 2013-01-24 19:10:58 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2013-01-24 19:39:09 UTC
Created attachment 14839 [details] [review]
[SIGNED-OFF] Bug 9486: t/Letters.t loads modules in wrong order

Because the unit test t/Letters.t loads C4::Letters before C4::Context,
and C4::Letters is not even vaguely thread-safe, the test tends to fail.
Usually. Moving the dbh mocking to before the use_ok('C4::Letters') test
fixes the problem.

To test:
1) Before applying patch, run `prove t/Letters.t` a few times. Note that
   it fails most of the time, if not all the time.
2) Apply patch.
3) Repeat step (1), noting that now it passes every time.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as advertised.
Comment 5 Jared Camins-Esakov 2013-01-24 19:44:19 UTC
This patch has been pushed to master.
Comment 6 Chris Cormack 2013-02-01 08:47:54 UTC
Pushed to 3.10.x will be in 3.10.3