20
20
from collections import OrderedDict
21
21
import copy
22
22
import functools
23
+ from http import cookies
23
24
import os
24
25
import re
25
26
import sys
26
27
import time
27
28
import unittest
28
29
from unittest import result as unitresult
30
+ import urllib .parse as urlparse
29
31
30
- import six
31
- from six .moves import http_cookies
32
- from six .moves .urllib import parse as urlparse
33
32
import wsgi_intercept
34
33
35
34
from gabbi import __version__
@@ -298,10 +297,10 @@ def _cookie_replacer(self, match):
298
297
referred_case = self .history [case ]
299
298
else :
300
299
referred_case = self .prior
301
- response_cookies = referred_case .response ['set-cookie' ]
302
- cookies = http_cookies .SimpleCookie ()
303
- cookies .load (response_cookies )
304
- cookie_string = cookies .output (attrs = [], header = '' , sep = ',' ).strip ()
300
+ response_cookie = referred_case .response ['set-cookie' ]
301
+ cookie = cookies .SimpleCookie ()
302
+ cookie .load (response_cookie )
303
+ cookie_string = cookie .output (attrs = [], header = '' , sep = ',' ).strip ()
305
304
return cookie_string
306
305
307
306
def _headers_replace (self , message , escape_regex = False ):
@@ -482,7 +481,7 @@ def _response_replacer(self, match, preserve=False):
482
481
return self ._cast_value (result , match .string )
483
482
return result
484
483
else :
485
- return six . text_type (result )
484
+ return str (result )
486
485
487
486
def _run_request (
488
487
self ,
@@ -514,8 +513,8 @@ def _run_request(
514
513
)
515
514
except wsgi_intercept .WSGIAppError as exc :
516
515
# Extract and re-raise the wrapped exception.
517
- six . reraise (exc .exception_type , exc .exception_value ,
518
- exc .traceback )
516
+ raise (exc .exception_type , exc .exception_value ,
517
+ exc .traceback )
519
518
520
519
# Set headers and location attributes for follow on requests
521
520
self .response = response
@@ -582,7 +581,7 @@ def _run_test(self):
582
581
583
582
# ensure body is bytes, encoding as UTF-8 because that's
584
583
# what we do here
585
- if isinstance (body , six . text_type ):
584
+ if isinstance (body , str ):
586
585
body = body .encode ('UTF-8' )
587
586
588
587
if test ['poll' ]:
@@ -637,10 +636,10 @@ def _test_data_to_string(self, data, content_type):
637
636
"""
638
637
dumper_class = self .get_content_handler (content_type )
639
638
if not _is_complex_type (data ):
640
- if isinstance (data , six . string_types ) and data .startswith ('<@' ):
639
+ if isinstance (data , str ) and data .startswith ('<@' ):
641
640
info = self .load_data_file (data .replace ('<@' , '' , 1 ))
642
641
if utils .not_binary (content_type ):
643
- data = six . text_type (info , 'UTF-8' )
642
+ data = str (info , 'UTF-8' )
644
643
else :
645
644
# Return early we are binary content
646
645
return info
@@ -661,7 +660,7 @@ def _test_data_to_string(self, data, content_type):
661
660
662
661
# If the result after template handling is not a string, dump
663
662
# it if there is a suitable dumper.
664
- if dumper_class and not isinstance (data , six . string_types ):
663
+ if dumper_class and not isinstance (data , str ):
665
664
# If there are errors dumping we want them to raise to the
666
665
# test harness.
667
666
data = dumper_class .dumps (data , test = self )
0 commit comments