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


Groups > comp.lang.python > #98004

Re: Unittests and serial workflows

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: Unittests and serial workflows
Date 2015-10-30 09:23 -0700
Organization A noiseless patient Spider
Message-ID <877fm4tjek.fsf@jester.gateway.sonic.net> (permalink)
References <n0mtgj$dag$1@speranza.aioe.org> <87twpcvnph.fsf@jester.gateway.sonic.net> <n1010b$mdn$1@speranza.aioe.org>

Show all headers | View raw


Fabien <fabien.maussion@gmail.com> writes:
>> Write B so that it doesn't require input to actually come from A, but
>> rather, write or generate some other sample input.  Then test B
>> separately from A.

> Thanks for your thoughts. I am not sure that this is always possible
> in my case, but I see what you mean.

It's generally difficult to take an existing program and add tests to
it, if that's what you're trying to do.  If you want a program with a
suite of tests, it's best to write the tests at the same time that you
write the code (so-called test-driven development or TDD).  Writing the
tests then steers the organization of the code, so that the functions
are independently testable.  You should also know about "mock objects"
which can supply interfaces that would normally expect to do (e.g.)
database queries or operations on a network.  I've generally written
those by hand, but I think there's a Python library module for them now.

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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