-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathtest_exceptions.py
More file actions
55 lines (50 loc) · 1.98 KB
/
test_exceptions.py
File metadata and controls
55 lines (50 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import pytest
from waterbutler.core import exceptions
class TestExceptionSerialization:
@pytest.mark.parametrize('exception_class', [
exceptions.WaterButlerError,
exceptions.InvalidParameters,
exceptions.UnsupportedHTTPMethodError,
exceptions.UnsupportedActionError,
exceptions.PluginError,
exceptions.AuthError,
exceptions.ProviderError,
exceptions.UnhandledProviderError,
exceptions.CopyError,
exceptions.CreateFolderError,
exceptions.DeleteError,
exceptions.DownloadError,
exceptions.IntraCopyError,
exceptions.IntraMoveError,
exceptions.MoveError,
exceptions.MetadataError,
exceptions.RevisionsError,
exceptions.UploadError,
exceptions.RetryChunkedUploadCommit,
exceptions.FolderNamingConflict,
exceptions.NamingConflict,
exceptions.ProviderNotFound,
exceptions.UploadChecksumMismatchError,
exceptions.UploadFailedError,
exceptions.NotFoundError,
exceptions.InvalidPathError,
exceptions.OverwriteSelfError,
exceptions.UnsupportedOperationError,
exceptions.ReadOnlyProviderError,
exceptions.UninitializedRepositoryError,
exceptions.UnexportableFileTypeError,
exceptions.InvalidProviderConfigError,
exceptions.WaterButlerRedisError,
exceptions.TooManyRequests,
])
def test_tolerate_dumb_signature(self, exception_class):
"""In order for WaterButlerError-inheriting exception classes to survive
pickling/unpickling, it is necessary for them to be able to be instatiated with
a single integer arg. The reasons for this are described in the docstring for
`waterbutler.core.exceptions.WaterButlerError`.
"""
try:
i_live_but_why = exception_class(616)
except Exception as exc:
pytest.fail(str(exc))
assert isinstance(i_live_but_why, exception_class)