Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78423
| References | <eaf17169-25d1-4022-a8de-3b0d6fd9afb8@googlegroups.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2014-09-27 18:27 -0600 |
| Subject | Re: Python unittesting method call issue |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14435.1411864095.18130.python-list@python.org> (permalink) |
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
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