File tree Expand file tree Collapse file tree 4 files changed +8
-30
lines changed Expand file tree Collapse file tree 4 files changed +8
-30
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ twine = "*"
2424anaconda-client = " *"
2525pipfile = " *"
2626wheel = " *"
27+ xxhash = " *"
28+ aiohttp = " *"
29+ async-timeout = " *"
2730
2831[requires ]
2932python_version = " 3.8"
Original file line number Diff line number Diff line change 22import os
33import shlex
44
5- encoding = os .getenv ("MOCKET_ENCODING" , "utf-8" )
5+ ENCODING = os .getenv ("MOCKET_ENCODING" , "utf-8" )
66
77text_type = str
88byte_type = bytes
99basestring = (str ,)
1010
11- FileNotFoundError = FileNotFoundError
12- BlockingIOError = BlockingIOError
1311
14- try :
15- from json .decoder import JSONDecodeError
16- except ImportError :
17- JSONDecodeError = ValueError
18-
19-
20- def encode_to_bytes (s , encoding = encoding ):
12+ def encode_to_bytes (s , encoding = ENCODING ):
2113 if isinstance (s , text_type ):
2214 s = s .encode (encoding )
2315 return byte_type (s )
2416
2517
26- def decode_from_bytes (s , encoding = encoding ):
18+ def decode_from_bytes (s , encoding = ENCODING ):
2719 if isinstance (s , byte_type ):
2820 s = codecs .decode (s , encoding , "ignore" )
2921 return text_type (s )
Original file line number Diff line number Diff line change 99import socket
1010import ssl
1111from datetime import datetime , timedelta
12+ from json .decoder import JSONDecodeError
1213
1314import decorator
1415import urllib3
1516from urllib3 .util .ssl_ import ssl_wrap_socket as urllib3_ssl_wrap_socket
1617from urllib3 .util .ssl_ import wrap_socket as urllib3_wrap_socket
1718
1819from .compat import (
19- BlockingIOError ,
20- FileNotFoundError ,
21- JSONDecodeError ,
2220 basestring ,
2321 byte_type ,
2422 decode_from_bytes ,
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
2- import os
32import sys
43
54
@@ -11,24 +10,10 @@ def main(args=None):
1110
1211 major , minor = sys .version_info [:2 ]
1312
14- python35 = False
15-
16- extras = ["xxhash" ]
17-
18- # aiohttp available on Python >=3.5
19- if major == 3 and minor >= 5 :
20- python35 = True
21-
22- extras += ["aiohttp" , "async_timeout" ]
23-
24- os .system ("pipenv run pip install {}" .format (" " .join (extras )))
25-
2613 if not any (a for a in args [1 :] if not a .startswith ("-" )):
2714 args .append ("tests/main" )
2815 args .append ("mocket" )
29-
30- if python35 :
31- args .append ("tests/tests35" )
16+ args .append ("tests/tests35" )
3217
3318 if major == 3 and minor >= 8 :
3419 args .append ("tests/tests38" )
You can’t perform that action at this time.
0 commit comments