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


Groups > comp.lang.python > #97964

Unittests and serial workflows

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail
From Fabien <fabien.maussion@gmail.com>
Newsgroups comp.lang.python
Subject Unittests and serial workflows
Date Tue, 27 Oct 2015 05:10:58 +0100
Organization Aioe.org NNTP Server
Lines 43
Message-ID <n0mtgj$dag$1@speranza.aioe.org> (permalink)
NNTP-Posting-Host wZQmFbcb36heiGJYwawpLQ.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
X-Notice Filtered by postfilter v. 0.8.2
X-Mozilla-News-Host news://news.aioe.org:119
Xref csiph.com comp.lang.python:97964

Show key headers only | View raw


Hi all,

I am not trained as a software developer and have only superficial 
knowledge about the theories and good practices of software testing.

Say I have several tasks (functions) A(), B(), C(), etc., each of them 
depending on the previous one. My understanding of unit testing is that 
each function should be tested alone and each test should be 
independent, so that currently my tests look like this:

class TestTasks(unittest.TestCase):

     def test_a(self):
         out = A()
         self.assertStuffs(out)

     def test_b(self):
         tmp = A()
         out = B(tmp)
         self.assertStuffs(out)

And so forth. The order in which unittest is running the test is not the 
one given by the code (it seems to be alphabetical?) so that I am not 
guaranteed that my functions are tested in the right order (my real 
tasks of course are not sorted alphabetically).

Furthermore, it is inefficient since task A() is going to be run many 
times. Of course I could run all the tasks once, store the results and 
run my tests afterwards one by one but this contradicts somehow the idea 
of unit testing. And I like to be able to run each test alone (in 
PyCharm a mouse click alone starts a single test).

My question(s): is Unittest the "right" framework for my needs? Should I 
move to Nosetests? Any hint to a useful, not too long document about 
testing framework and good practices?

Thanks a lot,

Fabien



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


Thread

Unittests and serial workflows Fabien <fabien.maussion@gmail.com> - 2015-10-27 05:10 +0100
  Re: Unittests and serial workflows Paul Rubin <no.email@nospam.invalid> - 2015-10-26 23:18 -0700
    Re: Unittests and serial workflows Fabien <fabien.maussion@gmail.com> - 2015-10-30 16:05 +0100
      Re: Unittests and serial workflows Paul Rubin <no.email@nospam.invalid> - 2015-10-30 09:23 -0700
  Re: Unittests and serial workflows Steven D'Aprano <steve@pearwood.info> - 2015-10-31 12:28 +1100

csiph-web