|
Have been meaning to do some work on
P4Python recently, and the first thing I realised I should do is to update
the test harness.
This is based around the unittest module so is fairly standard Python. Does
some fairly standard things with test suites etc, and provides a reasonably good
example of how to use the code itself, so acting as some level of documentation
of P4Python.
The old version assumed a pre-existing Perforce server installed and running
with some known content. This was fine for my own personal testing but had a
couple of problems:
- it assumed the training repository which is fine for Perforce Consulting
Partners but which isn't available to ordinary mortals (so they couldn't run
the test harness locally)
- was a snapshot with existing users and client workspaces so required a
license to use - not good for everyone
- it required too much manual setup before running
Obviously a candidate for tidying. So recent work done:
- Change to use the new
Perforce
Sample Repository which anyone can download and install (works without a
license too)
- Change to automatically create and run a new server instance on a fresh
install from the sample repository download (automatically unzip etc)
The end effect is fairly nice and automated, and provides a much better
ongoing resource to anyone wishing to do work on P4Python. Please note that it
currently assumes Windows environment, but will insert a few checks to make
platform independent shortly.
To have a look you can either:
Note that credit for various aspects should go to
Ravenbrook from their
work on P4DTI - I stole various techniques from their implementation of a test
harness.
It also serves as a reasonable example of a test harness for Perforce
scripting, and am very happy to receive comments and improvements (there are no
doubt some Python gurus out there who can suggest some improvements at points in
the code). I use something fairly similar as a test harness for the VSStoP4
scripts which are actually written in Perl (too horrible to write such a thing
in Perl was my feeling)!
Would like to encourage people to take their own copies and give back some
improvements in the general framework at least...
|