The Artima Developer Community
Sponsored Link

Python Buzz Forum
Testing Zen

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Sidnei da Silva

Posts: 137
Nickname: deecee
Registered: Nov, 2003

Sidnei da Silva is a dirty little brazilian python hacker
Testing Zen Posted: May 3, 2004 9:28 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Sidnei da Silva.
Original Post: Testing Zen
Feed Title: awkly.org
Feed URL: http://awkly.org/categories.rdf?category=Python
Feed Description: dreamcatching :: making your dreams come true
Latest Python Buzz Posts
Latest Python Buzz Posts by Sidnei da Silva
Latest Posts From awkly.org

Advertisement
Testing Zen

Here's what I did for getting a nice testing frontend into Zope 2.

  1. Copy test.py from Zope 3 into INSTANCE_HOME.

  2. Copy framework.py from ZopeTestCase into INSTANCE_HOME.

  3. Add the following to test.py:: if __name__ == '__main__':

    System Message: ERROR/3 (<string>, line 7)

    Unexpected indentation.

    execfile(os.path.join(sys.path[0], 'framework.py'))

  4. Add the following to framework.py``_, just after ``import Testing:: import Zope

Now, you can run the unittests using test.py and all the facilities that you get from it. As an example, here's what I have in the makefile of one of my products:

SOFTWARE_HOME=~/src/zope/2_7/lib/python
INSTANCE_HOME=~/src/instance/shellex
PYTHON="/usr/bin/python"

test_all :

        export INSTANCE_HOME=${INSTANCE_HOME}; \
        export SOFTWARE_HOME=${SOFTWARE_HOME}; \
        cd ${INSTANCE_HOME} && ${PYTHON} test.py --all -vpT \
        --libdir=Products 'CMFMember|Calendaring|PluggableDiscussion'

Here, -v is for verbose, -p is for showing progress, -T is for generating trace module stats. Refer to the source of test.py for more command line options. The nice thing here, IMHO, is to be able to specify a regular expression for matching modules which tests should be run, and of course, the progress line is simply amazing :)

Read: Testing Zen

Topic: more on that import craziness Previous Topic   Next Topic Topic: Goodbye, Cruel World.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use