Skip Menu |

This queue is for tickets about the Test-Class CPAN distribution.

Report information
The Basics
Id: 100411
Status: new
Priority: 0/
Queue: Test-Class

Owner: Nobody in particular
Requestors: dariusjokilehto [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

MIME-Version: 1.0
X-Ymail-Osg: DjAH9gcVM1mAJ2H5Zfdm0G2yUgVWgq.9P1NvNaWibcPFaDQtRwd.WLJxH0odhWh .ES3knCiNfVgAnmS0OnBBVzOickID.Y5Pi6sq1OZjNGoRaW8bl0_0ldM47wH_WWlPm4yGYcEIlH_ fBvYRawiyC4.hpe7K4jemMnCqUeRdcuL_aj80nnaO8dK6b4CUNFOz8uW3Y7iA3zygYXYpr7EEXAC 7gN21xm2ruDRa_S4VwuEnpsPAHW_L22N6kiyLhrbDzfpHY0k5xO5hHO4PSTzKWGbFEPAZv4GbCzT 8Or0EpVWNKeDAmmj81vbd157jVLSDrMHm7pspnrWdHrcP7WZkX5tC6eg2Fqzth6BXA3UjX4hqWCO kbNatGWmgBUQy9k4q09SANHe9thhkbAe2V3qQfZ6ELPgY1WuOk4R0U8vI2qV4VocDgvfE.PfDJLP i5D11oU.7mG1fnWZ9.B4ouvFI_dFMiN2iXauSfo.EcvZpg2.8gG2t6X6WcIZXmgegq6BIPXAL_B_ UcDBxTZci
X-Spam-Status: No, score=-0.1 tagged_above=-99.9 required=10 tests=[BAYES_40=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham
X-Yahoo-Newman-ID: [...]
X-Spam-Flag: NO
content-type: text/plain; charset="utf-8"
Message-ID: < [...]>
Reply-To: Darius Jokilehto <dariusjokilehto [...]>
X-Yahoo-Newman-Property: ymail-3
X-Virus-Scanned: Debian amavisd-new at
X-Spam-Score: -0.1
Received: from localhost (localhost []) by (Postfix) with ESMTP id 304BB240672 for <cpan-bug+Test-Class [...]>; Mon, 17 Nov 2014 13:03:53 -0500 (EST)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id B--hEsmcJqnZ for <cpan-bug+Test-Class [...]>; Mon, 17 Nov 2014 13:03:52 -0500 (EST)
Received: from ( []) by (Postfix) with SMTP id 16F7124008F for <bug-Test-Class [...]>; Mon, 17 Nov 2014 13:03:51 -0500 (EST)
Received: (qmail 28702 invoked by alias); 17 Nov 2014 18:03:49 -0000
Received: from (HELO ( by (qpsmtpd/0.28) with ESMTP; Mon, 17 Nov 2014 10:03:47 -0800
Received: from [] by with NNFMP; 17 Nov 2014 18:03:42 -0000
Received: from [] by with NNFMP; 17 Nov 2014 18:03:42 -0000
Received: from [] by with NNFMP; 17 Nov 2014 18:03:42 -0000
Received: by; Mon, 17 Nov 2014 18:03:42 +0000
Authentication-Results: (amavisd-new); dkim=pass header.i= [...]
Authentication-Results: (amavisd-new); domainkeys=softfail (fail, message has been altered) header.from=dariusjokilehto [...]
Delivered-To: cpan-bug+Test-Class [...]
Subject: Test::Class modules in aggregate test run leak into subsequent run modules
Return-Path: <dariusjokilehto [...]>
Domainkey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048;; b=bVSt2quM14240RhCTbKXCIX+Ng6O4ABeG0FGnH2zHEyjip0KxUTxTBNC9K9Jn4GwhbBpuv/R158uRKCYB6agMtfG2UvjprDjZT25HtaLwqs7OoWzjDMuNDj5l2Ui8pO5BLUg2WXq0RGooPRAMolTdyUJ7zlhZkiowQqzlGL5gWcNmUiwOgKvlLpcTUTnrpbqtoL2p7Mt+99RMc+0Y6AmLGKEMHsHop29Tkaxa0ypqRf++kPR7nW1s0X/QxCxDv0BXcbKx53oxyg+nN1cFkqrgfSQq9B5NQuRRXr7qj5yI7D9JFQoo8tqlVpLGOmpkLiO1UzhCBPadkMDQ8OMuY51/g==;
X-RT-Mail-Extension: test-class
X-Original-To: cpan-bug+Test-Class [...]
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=s2048; t=1416247422; bh=x8X+ny5lPqJgYsJk9Vk0+ps0a+APZy8uwnmFpPzZdb0=; h=Date:From:Reply-To:To:Subject:From:Subject; b=rfWIF4qCLgJGC5csxweDz2XRitKsBmcMCidy6q1jzhr9OyARQiIqN9LDQeJlhxwhqwLZVR2bMgLqqL9/n5HgkrvlosZ4F/75gGTe4rwagSPZ0TCAJEXxEVhaBtqzNNd7e2Ju5b1NOJbUchzeHIyLBQX4eyRQ+3FJJx3XalruBqkt6hl8hUnIdizuOtD/bKsgtvU3eqBYxw1wmOET18IdeCHo+knUgF+keKGCw9O6yAcdqW5ymDNylftb5uLkI+CapAXjdG53PCOjwOQK1QTuwg0i/5t9RRZefeNVPvDQaZeHYtLk9bLA7iV1dBT723/F2OEiBZGdDQ2SUYgZGECJyw==
Date: Mon, 17 Nov 2014 18:03:40 +0000 (UTC)
To: "bug-Test-Class [...]" <bug-Test-Class [...]>
Content-Transfer-Encoding: 7bit
From: Darius Jokilehto <dariusjokilehto [...]>
X-RT-Original-Encoding: utf-8
X-RT-Interface: Email
Content-Length: 1015
Download (untitled) / with headers
text/plain 1015b
In our test suite we have some Test::Class modules that all inherit from a subclass of Test::Class, and get run by a .t file that does the following: use Test::Class::Load "./t/classes"; Test::Class->runtests; We have recently been debugging some tests that create a mock object in their 'setup' method, and store it against $_[0]{mocked}, and it looks like this doesn't get destroyed once the test class module has finished running and moved onto the next module, which means our mocked objects leak into our next tests. I can't think of a case where this behaviour would be the desired one, I'd have thought the objects should get cleaned up once we've moved onto the next test class. Looking at the implementation, it seems the cause is this line in runtests: foreach my $t (@tests) { # stuff $t = $t->new unless ref($t); Since $t is an alias to an element of @tests, it won't be destroyed until the runtests method ends. You could just use a different variable to store the instance.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to