コード例 #1
0
    def ensure_non_empty(self):
        """
        Makes sure that the directory exists and is non-empty.
        """
        self.ensure_present()

        if not os.listdir(self.root):
            raise CommandError(
                'Directory %s is empty.  Use --allowEmptySource to sync anyway.'
                % (self.root, ))
コード例 #2
0
 def test_command_error(self):
     try:
         raise CommandError('foo')
     except CommandError as e:
         assert str(e) == 'foo', str(e)