Unit tests for revision ids stored along with diffs.

Review Request #2445 — Created June 29, 2011 and discarded

ballarin
Review Board
reviewboard
Unit tests for revision ids stored along with diffs.
This requires http://reviews.reviewboard.org/r/2094/ to be applied.
Before adding the tests: Ran 434 tests in 399.912s FAILED (SKIP=6, errors=3)
After adding test tests: Ran 436 tests in 354.798s FAILED (SKIP=6, errors=3)

The remaining errors are believed to be due to the tests (ungraceful handling of lacking repository support).

======================================================================
ERROR: Testing a SFTP-backed bzr repository
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/tests.py", line 261, in test_sftp
    self._test_ssh(self.bzr_sftp_path, 'README')
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/tests.py", line 65, in _test_ssh
    tool.check_repository(repo_path)
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/bzr.py", line 221, in check_repository
    except NotBranchError, e:
NameError: global name 'NotBranchError' is not defined

======================================================================
ERROR: Testing a SSH-backed bzr repository
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/tests.py", line 253, in test_ssh
    self._test_ssh(self.bzr_ssh_path, 'README')
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/tests.py", line 65, in _test_ssh
    tool.check_repository(repo_path)
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/bzr.py", line 221, in check_repository
    except NotBranchError, e:
NameError: global name 'NotBranchError' is not defined

======================================================================
ERROR: Testing a SSH-backed bzr repository with a LocalSite
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/tests.py", line 257, in test_ssh_with_site
    self._test_ssh_with_site(self.bzr_ssh_path, 'README')
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/tests.py", line 98, in _test_ssh_with_site
    lambda: tool.get_file(filename, HEAD));
  File "/usr/local/lib64/python2.6/site-packages/Django-1.3-py2.6.egg/django/utils/unittest/case.py", line 474, in assertRaises
    callableObj(*args, **kwargs)
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/tests.py", line 98, in <lambda>
    lambda: tool.get_file(filename, HEAD));
  File "/home/ballarin/work/reviewboard/reviewboard3/reviewboard/scmtools/bzr.py", line 124, in get_file
    except BzrError, e:
NameError: global name 'BzrError' is not defined

----------------------------------------------------------------------
Description From Last Updated

After this, please add: try: tool = self.repository.get_scmtool() except ImportError: raise nose.SkipTest('Hg is not installed') Otherwise, these tests will fail ...

daviddavid

Trailing whitespace.

daviddavid

Trailing whitespace.

daviddavid
david
  1. Once you fix these, can you make this available as a branch on github or put the binary repo somewhere for us?
    1. There is now a fork of reviewboard at github with a branch that contains these tests (along with http://reviews.reviewboard.org/r/2094/): https://github.com/ballarin/reviewboard/commits/branch.
  2. reviewboard/diffviewer/tests.py (Diff revision 1)
     
     
     
     
     
    After this, please add:
    try:
        tool = self.repository.get_scmtool()
    except ImportError:
        raise nose.SkipTest('Hg is not installed')
    
    Otherwise, these tests will fail if Hg isn't installed on the system.
  3. reviewboard/diffviewer/tests.py (Diff revision 1)
     
     
    Trailing whitespace.
  4. reviewboard/diffviewer/tests.py (Diff revision 1)
     
     
    Trailing whitespace.
  5. 
      
BA
BA
david
  1. Pushed a merge of your branch as 5d9a8d2. Thanks!
  2. 
      
BA
chipx86
  1. I had to revert this change. The raw SQL for updating every field ended up taking an eternity on even medium-sized deployments.
    
    The model will have to change to instead fall back on the existing field if the new one isn't populated. So instead of migrating anything, we'd have to insert the data for any new diffsets, but fetch the old field for existing ones.
  2. 
      
BA
Review request changed

Status: Discarded

Loading...