Well, since Python is so much fun, I decided to take a look at what I
could do in the test suite. And there I noticed the todo item to
check the entries file against the desired results. So I decided to
work on that.
Then, I thought that really, the expected results and the hierarchy of
entries files were both really trees, and I could just convert them
all to trees and then compare them.
Then I realized that many of the things we want to compare are really
representations of trees in the filesystem (the disk filesystem, not
the SVN filesytem). So I figured, why not create a generic tree
structure, and have lots of mappings to it?
So that's what I did.
So, with the history out of the way, here's the details. As I see it,
there are a large number of different representations of what the
on-disk filesystem looks like (not even counting the one in the SVN
filesystem, which the black box testing doesn't see).
- The output of svn commands like checkout.
- The SVN/entries files
- the CVS/Entries files, for cvs2svn
- The actual on-disk files
- The expected results (which may or may not be the same as one of
the above)
There may be more as well.
So, we should have a generic representation of all of these, and a way
to transform to that representation.
The way I have constructed that representation is with a single python
class, SVNTreeNode. However, you shouldn't ever have to deal with
that class at all. The interfaces will look like so:
# create a tree from the expected paths
exp_tree = create_tree_from_paths(greek_paths)
# create a tree from the output
result_tree = create_tree_from_output(output)
# make sure they're the same
if not(compare_trees(exp_tree, result_tree)):
print "Eeek!"
I've already written create_tree_from_paths(), and it parses the
greek_trees variable in xml_tests.py properly. I've also written the
comparison function, and the rest of the basic infrastructure. Before
I wrote parsers for the rest, I'd like to make sure that no one has
serious problems with the way I'm going about this.
Attached is svn_tree.py, with the current implementation.
sam th --- sam_at_uchicago.edu --- http://www.abisource.com/~sam/
OpenPGP Key: CABD33FC --- http://samth.dyndns.org/key
DeCSS: http://samth.dyndns.org/decss
- application/pgp-signature attachment: stored
Received on Sat Oct 21 14:36:28 2006