Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78423

Re: Python unittesting method call issue

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 <ian.g.kelly@gmail.com>
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 <eaf17169-25d1-4022-a8de-3b0d6fd9afb8@googlegroups.com>
References <eaf17169-25d1-4022-a8de-3b0d6fd9afb8@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sat, 27 Sep 2014 18:27:27 -0600
Subject Re: Python unittesting method call issue
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14435.1411864095.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Sat, Sep 27, 2014 at 5:25 PM, Milson Munakami <milsonmun@gmail.com> wrote:
> I am trying to set the precondition for the test first prior to test other 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 with in that method i.e. SetPreConditionFirewall() with setup variable self.<variablename> 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.

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Python unittesting method call issue Milson Munakami <milsonmun@gmail.com> - 2014-09-27 16:25 -0700
  Re: Python unittesting method call issue Chris Angelico <rosuav@gmail.com> - 2014-09-28 09:42 +1000
  Re: Python unittesting method call issue Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-27 18:27 -0600
  Re: Python unittesting method call issue Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-28 12:19 +1000
  Re: Python unittesting method call issue Milson Munakami <milsonmun@gmail.com> - 2014-10-02 08:30 -0700

csiph-web