[pypy-dev] about to check in refactored test-framework

holger krekel hpk at trillke.net
Wed Jun 18 12:26:41 CEST 2003


hello pypy,

since yesterday evening i cleaned up the all of our test stuff.

I haven't checked it in, yet. I'd like to know if anybody 
has any strong feelings about the way it currently is...

And here is how the refactored test stuff works:

- all the testsupport, testcts, testwice and all the code duplications
  that came with it are gone. 

- not need to set any PYTHONPATH anymore to start a test or
  interpreter/interactive.py or interpreter/main.py 

- you can start any test by simply calling it directly via

    python test_XXX.py 

- you can run all tests by 

    python test_all.py  # in the root directory

- you can run all tests below your current working dir
  say e.g. in interpreter/

    python ../test_all.py  # will start from the current dir

- you can run all tests in one object space via

    python test_all.py -S  # standard objectspace
    python test_all.py -T  # trivial objectspace
    python test_all.py -ST # first standard, then trivial objectspace

- you can pass some regular expressions 

    python test_all.py pypy.interpreter # will only run tests whose path
                                          matches pypy.interpreter

    python test_all.py -S "%pypy.(obj|app)space"
    # will avoid objspace and appspace tests and otherwise run with
    # stdobjspace, the '%' inverts the match, btw 

- autopath configuration. 

  every startable script (the tests among them, but also
  interpreter/interactive.py interpreter/main.py) first does a

    import autopath 

  which configures the python path to include the directory
  which contains 'pypy'. moreover autopath provides some
  attributes 

    pypydir   the 'pypy' directory path itself 
    this_dir  the directory where your "autopath" lives
              useful for finding test data

  if you run pypy/tool/autopath.py then this will copy itself
  over all other 'autopath.py' instances and report "sync" status. 
  No ugly shell scripting anymore. OTOH autopath.py will hardly 
  need to be modified anymore because it just does path manipulation.

- every test_*.py usually does

    import autopath
    from pypy.tool import test

  and derives from test.TestCase or test.AppTestCase and 
  on __name__=='__main__' invokes
    
    test.main()

  to get to the "cmdline switched" objectspace you call

    test.objspace()

  to get to a specific objectspace you call
    
    test.objspace('std') or test.objspace('trivial')

Some stuff regarding running tests successively in StdObjSpace and
TrivialObjSpace (switch "-ST") is not completly right at the moment. But this
is not so much a thing of the test framework, i think. 

As this checkin involves a lot of files i'd like
to do the checkin ASAP to avoid conflicts. 

Any oppinions? 

regards,

    holger


More information about the Pypy-dev mailing list