~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__rio.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-08 21:37:36 UTC
  • mto: This revision was merged to the branch mainline in revision 4885.
  • Revision ID: john@arbash-meinel.com-20091208213736-vje7ublg3xzp1bs2
Now that we return files directly from the working tree
the windows 'attrib' test needed to be updated.
If we used the working tree for both old and new, then the test wasn't
really testing what we expected, which was that the newly generated
content was readable.

But using basis_tree gets us that. Also, test that the content is
properly marked as readonly, and that we have available content from
the working tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
23
23
 
24
24
 
25
25
def load_tests(standard_tests, module, loader):
26
 
    suite, _ = tests.permute_tests_for_extension(standard_tests, loader,
27
 
        'bzrlib._rio_py', 'bzrlib._rio_pyx')
 
26
    # parameterize all tests in this module
 
27
    suite = loader.suiteClass()
 
28
    import bzrlib._rio_py as py_module
 
29
    scenarios = [('python', {'module': py_module})]
 
30
    if CompiledRioFeature.available():
 
31
        import bzrlib._rio_pyx as c_module
 
32
        scenarios.append(('C', {'module': c_module}))
 
33
    else:
 
34
        # the compiled module isn't available, so we add a failing test
 
35
        class FailWithoutFeature(tests.TestCase):
 
36
            def test_fail(self):
 
37
                self.requireFeature(CompiledRioFeature)
 
38
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
 
39
    tests.multiply_tests(standard_tests, scenarios, suite)
28
40
    return suite
29
41
 
30
42
 
 
43
class _CompiledRioFeature(tests.Feature):
 
44
 
 
45
    def _probe(self):
 
46
        try:
 
47
            import bzrlib._rio_pyx
 
48
        except ImportError:
 
49
            return False
 
50
        return True
 
51
 
 
52
    def feature_name(self):
 
53
        return 'bzrlib._rio_pyx'
 
54
 
 
55
CompiledRioFeature = _CompiledRioFeature()
 
56
 
 
57
 
31
58
class TestValidTag(tests.TestCase):
32
59
 
33
60
    module = None # Filled in by test parameterization