Re: Repeated name of unit tests



El Xov, 04-10-2007 a las 08:44 +0200, Iago Toral escribió:
> It is not clear to me right now why this is
> happening, but I can check on my dev environment if the same happens to
> me and why this is happening.

I created a code in python with characteristics of problematic code and
this is the result:

CODE----------------------------------------------------------------
class Test2:   #in global-config class UnitTestsObserver
	newVar = []  # in global-config variable unittests

	def __init__(self):
		print self.newVar, "---INITIALIZATION---\n"
      
	def function1(self):  #in global-config function outLineReceived
		self.newVar.append(("newVar"))
		print self.newVar
		self.newVar=[]
		self.newVar = "newVarChanged"
		print self.newVar

class Main:
	a1 = Test2()      #this represents first build
	a1.function1()

	print "\nNEW CLASS\n"	
	a2 = Test2()      #this represents second build
END OF CODE--------------------------------------------------------

When I execute this code:

RESULT-------------------------------------------------------------
[] ---INITIALIZATION---

['newVar']
newVarChanged

NEW CLASS

['newVar'] ---INITIALIZATION---
END OF RESULT------------------------------------------------------

This is the same behaviour than in buildbot. I suppose before seeing
this, that in second initialization self.newVar would be [], and not
first value puts with append, but it isn't so. So if the following line
is added
	self.newVar = [] 
in __init__ function, when a new class is created the value is the
default for that variable.

This mail can be a bit repetitive with previously one I have sent, but I
think that this is more explanatory.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]