~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_baz_import.py

  • Committer: Robert Collins
  • Date: 2005-09-13 10:46:27 UTC
  • mto: (147.2.6) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@robertcollins.net-20050913104627-51f938950a907475
handle inaccessible sibling archives somewhat - note version-0 is still not handled

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    along with this program; if not, write to the Free Software
16
16
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
from bzrlib.selftest import TestCaseInTempDir
 
18
from bzrlib.selftest import TestCaseInTempDir, TestCase
19
19
from bzrlib.selftest.blackbox import has_symlinks
20
20
try:
21
21
    import pybaz
28
28
import tempfile
29
29
from testresources import (TestResource, TestLoader, OptimisingTestSuite,
30
30
                           ResourcedTestCase)
 
31
from fai.cmdutil import namespace_previous
31
32
 
32
33
def test_suite():
33
34
    if pybaz is None:
314
315
        entry = inv['x_symlink_tag']
315
316
        self.assertEqual(entry.kind, 'symlink')
316
317
        self.assertEqual(entry.symlink_target, 'missing-file-name')
 
318
 
 
319
 
 
320
class TestNamespacePrevious(TestCase):
 
321
 
 
322
    def setUp(self):
 
323
        TestCase.setUp(self)
 
324
        self.version = pybaz.Version('foo@example.com/c--b--0')
 
325
 
 
326
    def test_base0_none(self):
 
327
        self.assertEqual(namespace_previous(self.version['base-0']), None)
 
328
 
 
329
    def test_patch1_base0(self):
 
330
        self.assertEqual(namespace_previous(self.version['patch-1']),
 
331
                         self.version['base-0'])
 
332
        
 
333
    def test_patch3000_patch2999(self):
 
334
        self.assertEqual(namespace_previous(self.version['patch-3000']),
 
335
                         self.version['patch-2999'])
 
336
        
 
337
    def test_version0_raises(self):
 
338
        self.assertRaises(RuntimeError, namespace_previous,
 
339
                          self.version['version-0'])
 
340
 
 
341
    def test_version1_version0(self):
 
342
        self.assertEqual(namespace_previous(self.version['version-1']),
 
343
                         self.version['version-0'])