[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] tests print out tree metadata as py script

From: Neels Janosch Hofmeyr <neels_at_elego.de>
Date: Sun, 17 Aug 2008 01:10:29 +0200

Currently, if a cmdline test fails at verifying the expected output-,
disk-, status- or skip-tree, it shows the metadata of only the first
encountered mismatching node.

This patch prints out the complete actual tree with its metadata (in
case of a tree node mismatch). It prints the tree in python syntax,
which is easy to read and practical.

Instead of just being informed about the first encountered node
mismatch, it is possible to see patterns in the different nodes'
metadata at a quick glance.

I can choose to copy-and-paste the error message's printout of the
actually found tree into my python test script to pass the current
situation.

It's valuable information for the test developer, with relatively few
additional output lines, in a familiar and practical format.

For illustration, I simulated a failure of `update_tests.py 9'. Here is
the complete error output; the 16 lines starting with "ACTUAL OUTPUT
TREE:" are added by this patch:

$ ./update_tests.py 9
=============================================================
Expected 'E' and actual 'E' in output tree are different!
=============================================================
EXPECTED NODE TO BE:
=============================================================
 * Node name: E
    Path: svn-test-work/working_copies/update_tests-9/A/B/E
    Contents: N/A (node is a directory)
    Properties: {}
    Attributes: {'status': 'D '}
    Children: 2
=============================================================
ACTUAL NODE FOUND:
=============================================================
 * Node name: E
    Path: svn-test-work/working_copies/update_tests-9/A/B/E
    Contents: N/A (node is a directory)
    Properties: {}
    Attributes: {'status': 'A '}
    Children: 2
Unequal at node E
Unequal at node B
Unequal at node A
Unequal at node update_tests-9
Unequal at node working_copies
Unequal at node svn-test-work
ACTUAL OUTPUT TREE:
svntest.wc.State('svn-test-work/working_copies/update_tests-9', {
'A' : Item(),
'A/mu' : Item(verb='Restored'),
'A/D' : Item(),
'A/D/G' : Item(),
'A/D/G/rho' : Item(verb='Restored'),
'A/D/H' : Item(status='A '),
'A/D/H/chi' : Item(status='A '),
'A/D/H/omega' : Item(status='A '),
'A/D/H/psi' : Item(status='A '),
'A/B' : Item(),
'A/B/E' : Item(status='A '),
'A/B/E/alpha' : Item(status='A '),
'A/B/E/beta' : Item(status='A '),
})
EXCEPTION: SVNTreeUnequal
Traceback (most recent call last):
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/main.py",
line 1113, in run
    rc = apply(self.pred.run, (), kw)
  File
"/arch/elego/svn/tc/subversion/tests/cmdline/svntest/testcase.py", line
121, in run
    return self.func(sandbox)
  File "./update_tests.py", line 336, in update_missing
    E_path, H_path)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/actions.py",
line 722, in run_and_verify_update
    check_props)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/actions.py",
line 612, in verify_update
    tree.compare_trees ("output", actual_output, output_tree)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/tree.py",
line 572, in compare_trees
    singleton_handler_b, b_baton)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/tree.py",
line 572, in compare_trees
    singleton_handler_b, b_baton)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/tree.py",
line 572, in compare_trees
    singleton_handler_b, b_baton)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/tree.py",
line 572, in compare_trees
    singleton_handler_b, b_baton)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/tree.py",
line 572, in compare_trees
    singleton_handler_b, b_baton)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/tree.py",
line 572, in compare_trees
    singleton_handler_b, b_baton)
  File "/arch/elego/svn/tc/subversion/tests/cmdline/svntest/tree.py",
line 558, in compare_trees
    raise SVNTreeUnequal
SVNTreeUnequal
FAIL: update_tests.py 9: update missing items (by name) in working copy

[[[
Make the cmdline tests print out the complete actual tree and meta-
data, as python script, in case of a node mismatch in output, disk,
status or skip tree.

* subversion/tests/cmdline/svntest/tree.py
  (print_script): New function in SVNTreeNode class, prints out the node
    metadata as python script line.
  (dump_tree_script): New function, prints a whole tree as py script,
    using print_script().

* subversion/tests/cmdline/svntest/actions.py
  (verify_update): Print the output or disk tree if tree comparison
    throws an exception, using dump_tree_script() from tree.py.
  (run_and_verify_merge2): Print the skip tree if tree comparison
    throws an exception, using dump_tree_script() from tree.py.
  (run_and_verify_status): Print the status tree if tree comparison
    throws an exception, using dump_tree_script() from tree.py.
]]]

-- 
Neels Hofmeyr -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23458696  mobile: +49 177 2345869  fax: +49 30 23458695
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelsreg: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194

Received on 2008-08-17 01:11:07 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.