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


Groups > comp.lang.python > #58219

Re: Testing python command line apps -- Running from within the projects w/o installing

Date 2013-10-31 19:45 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: Testing python command line apps -- Running from within the projects w/o installing
References <20131031201207.GA9547@proxima.centauri>
Newsgroups comp.lang.python
Message-ID <mailman.1896.1383266628.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2013-10-31 22:12, Göktuğ Kayaalp wrote:
> My usual practise is to have two entry points to the program as
> executable scripts. 

When I create stand-alone command-line scripts that take arguments,
usually they're akin to version-control tools, so I have the form

  scriptname.py [--global-opts] <command> [--command-opts] [args]

so I just make one of my <command>s allow for "test".  That way, I
can execute my tests as easily as my program.  If I've added config
parsing and script behavior depends on them, I might even create a
test harness that does something like

  #!/bin/sh
  for f in one.ini two.ini three.ini
  do
    scriptname.py --config="$f" test
  done

That way, if some of my tests take a long time to run, I can even
make sub-commands to test a subset of the functionality to speed it
up:

  scriptname.py test web-ui
  scriptname.py test database
  ...

-tkc


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


Thread

Re: Testing python command line apps -- Running from within the projects w/o installing Tim Chase <python.list@tim.thechases.com> - 2013-10-31 19:45 -0500

csiph-web