Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.93
diff -u -p -r1.93 simpletest.module
--- modules/simpletest/simpletest.module	1 Sep 2010 20:08:17 -0000	1.93
+++ modules/simpletest/simpletest.module	22 Sep 2010 18:38:08 -0000
@@ -367,8 +367,14 @@ function simpletest_test_get_all() {
 function simpletest_registry_files_alter(&$files, $modules) {
   foreach ($modules as $module) {
     // Only add test files for disabled modules, as enabled modules should
-    // already include any test files they provide.
-    if (!$module->status) {
+    // already include any test files they provide. Ensure the module is either
+    // a profile (has a .profile file) or is not in the profiles directory. The
+    // testing system cannot test modules in a profile since the profile has to
+    // be enable during the test for the modules to be available, as such the
+    // profile itself is the only one capable of testing the modules in the
+    // profile since its test will use itself as the profile.
+    if (!$module->status &&
+      (in_array($module->name . '.profile', $module->info['files']) || current(explode('/', $module->dir, 2)) != 'profiles')) {
       $dir = $module->dir;
       if (!empty($module->info['files'])) {
         foreach ($module->info['files'] as $file) {
