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:
Obviously a candidate for tidying. So recent work done:
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...