Download & Extend

Filename cannot be empty if a test lasts less than 1s

Project:SimpleTest
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I have two test files. When I launch simpletest, if the first test lasts less than 1s I get the following error:

PHP Fatal error: require_once() [function.require]: Failed opening required '' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Users/matthieu/Sites/portal/sites/all/modules/simpletest/simpletest.module on line 211

The simpletest_test_get_all_classes() returns an empty array because all test files are already included.

This error occurs when two tests are performed by one call of batch with the same context. I found the condition in the batch.inc file line 214

if ($batch['progressive'] && timer_read('batch_processing') > 1000) {
break;
}

The solution I use temporarly is to test if the array returned by simpletest_test_get_all_classes() is empty (simpletest.module line 210):
$classes = simpletest_test_get_all_classes();
if (!empty($classes) {
require_once $classes[$test_class]['file'];
}

Comments

#1

Project:SimpleTest» Drupal core
Version:6.x-2.9» 7.x-dev
Component:Code» simpletest.module

Seems like this may effect core as well and should be fixed and backported.

#2

I'm not involved in D7 development, but I just ran into this issue with D6 and simpletest module. I rolled a patch file based on the proposed fix above. Hoping that this will get the fix to be included in the D6 simpletest distribution, I'm uploading it here. Again, this is a patch for D6 version of simpletest module!

AttachmentSizeStatusTest resultOperations
simpletest-DRUPAL-6--2-627390.patch771 bytesIgnored: Check issue status.NoneNone

#3

Project:Drupal core» SimpleTest
Version:7.x-dev» 6.x-2.x-dev
Component:simpletest.module» Code

Since Drupal 7.x autoloads classes this won't effect it.

#4

Status:active» fixed

Committed.

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#6

Ouch, just ran into this again on a different installation, forgot about it. Is the D6 version of Simpletest going to have another release? I'd really appreciate that...

#7

Please ignore this patch. This is only needed for http://drupal.org/project/drupalorg_testing - I uploaded it here because it is pulled in from a makefile in that project and the patch needs a place to live that makes sense :)

AttachmentSizeStatusTest resultOperations
fiilename_cannot_be_empty_627390-7.patch618 bytesIgnored: Check issue status.NoneNone
nobody click here