Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f09d65c

Browse files
author
Andres Sanchez
committedDec 13, 2018
Migrate unit/test_aws_encryption_sdk.py from unittest to pytest
1 parent 1b73b4c commit f09d65c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎test/unit/test_aws_encryption_sdk.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
"""Unit test suite for high-level functions in aws_encryption_sdk module"""
14-
import unittest
15-
1614
import pytest
1715
import six
1816
from mock import MagicMock, patch, sentinel
@@ -23,8 +21,9 @@
2321
pytestmark = [pytest.mark.unit, pytest.mark.local]
2422

2523

26-
class TestAwsEncryptionSdk(unittest.TestCase):
27-
def setUp(self):
24+
class TestAwsEncryptionSdk(object):
25+
@pytest.fixture(autouse=True)
26+
def apply_fixtures(self):
2827
# Set up StreamEncryptor patch
2928
self.mock_stream_encryptor_patcher = patch("aws_encryption_sdk.StreamEncryptor")
3029
self.mock_stream_encryptor = self.mock_stream_encryptor_patcher.start()
@@ -77,5 +76,6 @@ def test_stream_decryptor_decrypt(self):
7776
assert test is self.mock_stream_decryptor_instance
7877

7978
def test_stream_unknown(self):
80-
with six.assertRaisesRegex(self, ValueError, "Unsupported mode: *"):
79+
with pytest.raises(ValueError) as excinfo:
8180
aws_encryption_sdk.stream(mode="ERROR", a=sentinel.a, b=sentinel.b, c=sentinel.b)
81+
excinfo.match("Unsupported mode: *")

0 commit comments

Comments
 (0)
Please sign in to comment.