Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.06; 'setup.': 0.07; 'test,': 0.07; 'subject:method': 0.09; 'unittest': 0.09; 'subject:issue': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'trying': 0.19; 'command': 0.22; 'print': 0.22; 'code:': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'sep': 0.31; 'run': 0.32; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'i.e.': 0.36; 'method': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'first': 0.61; 'you.': 0.62; 'name': 0.63; 'fire': 0.65; 'here': 0.66; 'special': 0.74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=pV9btZQl4aXAnyGyFCXZHIJuHgehyBVwD64wxNeH8KU=; b=ozW8jprsO1llCquYgXcho6Bmtew/PZRWE4AFrRI4lfdpzSx0I1qAeZE7rj0J8AXri7 sFnTVpLepGQbMbDAiIMVxdDf1DTU8D1Tq5RzJYKTUg/Rd8yPbcz3P646Cma2vpxgdl+u VtYiF8qHpmP51YKQOa7JXFaWmQzv4A0lMidsw0UJg46UWiVjWD+Hg27PZPo468m7KFop T5QROjj2BDGQ47zIkd1ehiXY3XmfZh4BOpcLnYYs2w1fYiFPQQ8vx5pJYHJz7lZwV2ol OQsxUB4hyuG54B2FxrNDSny7wTOlSAwDepm5nUNGGOj4BW6Jtv0MSp7DA1aT+D72xc8Z cPIw== X-Received: by 10.180.211.36 with SMTP id mz4mr56535502wic.39.1411864087641; Sat, 27 Sep 2014 17:28:07 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Sat, 27 Sep 2014 18:27:27 -0600 Subject: Re: Python unittesting method call issue To: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411864096 news.xs4all.nl 2952 [2001:888:2000:d::a6]:43562 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3830 X-Received-Body-CRC: 1884599647 Xref: csiph.com comp.lang.python:78423 On Sat, Sep 27, 2014 at 5:25 PM, Milson Munakami wrot= e: > I am trying to set the precondition for the test first prior to test othe= r test cases. But as you can see in my code the precondition print command = is not fired! Can you explain the cause and solution how to fire the code w= ith in that method i.e. SetPreConditionFirewall() with setup variable self.= in this fucntion. Here is my code: The method doesn't run because you never called it, and the name has no special meaning to unittest, so unittest is not going to call it for you. The method that gets called prior to each test is setUp. So if you want SetPreConditionFirewall to be called before each test, then call it from setUp.