diff options
| author | Max Wittig <max.wittig@siemens.com> | 2020-08-26 11:01:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-26 11:01:17 +0200 |
| commit | a7e44a0bb3629f776a52967d56ba67d9a61346eb (patch) | |
| tree | 24fb533a60a84e71386cc500d6ac2f00548f96ac /gitlab/tests/test_exceptions.py | |
| parent | e2dc9ece1a0af37073c41bfa8161fcec5fa01234 (diff) | |
| parent | 204782a117f77f367dee87aa2c70822587829147 (diff) | |
| download | gitlab-a7e44a0bb3629f776a52967d56ba67d9a61346eb.tar.gz | |
Merge pull request #1078 from python-gitlab/refactor/split-unit-tests
Refactor: split unit tests by API resources
Diffstat (limited to 'gitlab/tests/test_exceptions.py')
| -rw-r--r-- | gitlab/tests/test_exceptions.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gitlab/tests/test_exceptions.py b/gitlab/tests/test_exceptions.py index 1f00af0..57b394b 100644 --- a/gitlab/tests/test_exceptions.py +++ b/gitlab/tests/test_exceptions.py @@ -1,19 +1,18 @@ -import unittest +import pytest from gitlab import exceptions -class TestExceptions(unittest.TestCase): - def test_error_raises_from_http_error(self): - """Methods decorated with @on_http_error should raise from GitlabHttpError.""" +def test_error_raises_from_http_error(): + """Methods decorated with @on_http_error should raise from GitlabHttpError.""" - class TestError(Exception): - pass + class TestError(Exception): + pass - @exceptions.on_http_error(TestError) - def raise_error_from_http_error(): - raise exceptions.GitlabHttpError + @exceptions.on_http_error(TestError) + def raise_error_from_http_error(): + raise exceptions.GitlabHttpError - with self.assertRaises(TestError) as context: - raise_error_from_http_error() - self.assertIsInstance(context.exception.__cause__, exceptions.GitlabHttpError) + with pytest.raises(TestError) as context: + raise_error_from_http_error() + assert isinstance(context.value.__cause__, exceptions.GitlabHttpError) |
