File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 23
23
import struct
24
24
25
25
import unittest
26
- from unittest .mock import patch
26
+ from sys import version_info
27
+
28
+ if version_info >= (3 ,):
29
+ from unittest .mock import patch
27
30
28
31
from tests .avro import data_gen
29
32
from confluent_kafka .avro .serializer .message_serializer import MessageSerializer
30
33
from tests .avro .mock_schema_registry_client import MockSchemaRegistryClient
31
34
from confluent_kafka import avro
35
+ from pyflakes .test .harness import skipIf
32
36
33
37
34
38
class TestMessageSerializer (unittest .TestCase ):
@@ -76,6 +80,8 @@ def test_encode_record_with_schema(self):
76
80
message = self .ms .encode_record_with_schema (topic , basic , record )
77
81
self .assertMessageIsSame (message , record , schema_id )
78
82
83
+ @skipIf (version_info < (3 ,),
84
+ 'unittest.mock.patch not available in Python 2' )
79
85
def test_encode_record_with_schema_sets_writers_cache_once (self ):
80
86
topic = 'test'
81
87
basic = avro .loads (data_gen .BASIC_SCHEMA )
You can’t perform that action at this time.
0 commit comments