mirror of https://github.com/borgbackup/borg.git
use builtin NotImplementedError instead of writing our own
NotImplemented didn't work with pytest.raise(), i didn't know about NotImplementedError, thanks tw
This commit is contained in:
parent
ef0ed409b6
commit
d66516351f
|
@ -17,7 +17,7 @@ import traceback
|
|||
from . import __version__
|
||||
from .archive import Archive, ArchiveChecker, CHUNKER_PARAMS
|
||||
from .compress import Compressor, COMPR_BUFFER
|
||||
from .converter import AtticRepositoryConverter, NotImplementedException
|
||||
from .converter import AtticRepositoryConverter
|
||||
from .repository import Repository
|
||||
from .cache import Cache
|
||||
from .key import key_creator
|
||||
|
@ -468,7 +468,7 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
|
|||
repo = AtticRepositoryConverter(os.path.join(args.repository, 'repository'), create=False)
|
||||
try:
|
||||
repo.convert(args.dry_run)
|
||||
except NotImplementedException as e:
|
||||
except NotImplementedError as e:
|
||||
print("warning: %s" % e)
|
||||
return self.exit_code
|
||||
|
||||
|
|
|
@ -5,9 +5,6 @@ from .helpers import get_keys_dir
|
|||
from .repository import Repository, MAGIC
|
||||
from .key import KeyfileKey, KeyfileNotFoundError
|
||||
|
||||
class NotImplementedException(Exception):
|
||||
pass
|
||||
|
||||
class AtticRepositoryConverter(Repository):
|
||||
def convert(self, dryrun=True):
|
||||
"""convert an attic repository to a borg repository
|
||||
|
@ -108,7 +105,7 @@ class AtticRepositoryConverter(Repository):
|
|||
`Cache.open()`, edit in place and then `Cache.close()` to
|
||||
make sure we have locking right
|
||||
"""
|
||||
raise NotImplementedException('cache conversion not implemented, next borg backup will take longer to rebuild those caches')
|
||||
raise NotImplementedError('cache conversion not implemented, next borg backup will take longer to rebuild those caches')
|
||||
|
||||
class AtticKeyfileKey(KeyfileKey):
|
||||
"""backwards compatible Attic key file parser"""
|
||||
|
|
|
@ -12,7 +12,7 @@ except ImportError:
|
|||
pytestmark = pytest.mark.skipif(attic is None,
|
||||
reason = 'cannot find an attic install')
|
||||
|
||||
from ..converter import AtticRepositoryConverter, NotImplementedException, AtticKeyfileKey
|
||||
from ..converter import AtticRepositoryConverter, AtticKeyfileKey
|
||||
from ..helpers import get_keys_dir
|
||||
from ..key import KeyfileKey
|
||||
from ..repository import Repository, MAGIC
|
||||
|
@ -87,7 +87,7 @@ class EncryptedConversionTestCase(ConversionTestCase):
|
|||
# check should fail because of magic number
|
||||
self.check_repo(False)
|
||||
print("opening attic repository with borg and converting")
|
||||
with pytest.raises(NotImplementedException):
|
||||
with pytest.raises(NotImplementedError):
|
||||
self.open(self.tmppath, repo_type = AtticRepositoryConverter).convert(dryrun=False)
|
||||
# check that the new keyfile is alright
|
||||
keyfile = os.path.join(get_keys_dir(),
|
||||
|
|
Loading…
Reference in New Issue