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.
Created attachment 14831 [details] [review] 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.
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
Created attachment 14835 [details] [review] 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>
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.
This patch has been pushed to master.
Pushed to 3.10.x will be in 3.10.3