##// END OF EJS Templates
tests: use absolute_import in /get-with-headers.py...
Gregory Szorc -
r27296:8e86679d default
parent child Browse files
Show More
@@ -3,18 +3,15 b''
3 """This does HTTP GET requests given a host:port and path and returns
3 """This does HTTP GET requests given a host:port and path and returns
4 a subset of the headers plus the body of the result."""
4 a subset of the headers plus the body of the result."""
5
5
6 import httplib, sys
6 from __future__ import absolute_import
7
8 import httplib
9 import json
10 import os
11 import sys
7
12
8 try:
13 try:
9 import json
14 import msvcrt
10 except ImportError:
11 try:
12 import simplejson as json
13 except ImportError:
14 json = None
15
16 try:
17 import msvcrt, os
18 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
15 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
19 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
16 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
20 except ImportError:
17 except ImportError:
@@ -58,11 +55,6 b' def request(host, path, show):'
58 # Pretty print JSON. This also has the beneficial side-effect
55 # Pretty print JSON. This also has the beneficial side-effect
59 # of verifying emitted JSON is well-formed.
56 # of verifying emitted JSON is well-formed.
60 if formatjson:
57 if formatjson:
61 if not json:
62 print 'no json module not available'
63 print 'did you forget a #require json?'
64 sys.exit(1)
65
66 # json.dumps() will print trailing newlines. Eliminate them
58 # json.dumps() will print trailing newlines. Eliminate them
67 # to make tests easier to write.
59 # to make tests easier to write.
68 data = json.loads(data)
60 data = json.loads(data)
@@ -145,7 +145,6 b''
145 setup.py not using absolute_import
145 setup.py not using absolute_import
146 tests/filterpyflakes.py requires print_function
146 tests/filterpyflakes.py requires print_function
147 tests/generate-working-copy-states.py requires print_function
147 tests/generate-working-copy-states.py requires print_function
148 tests/get-with-headers.py not using absolute_import
149 tests/get-with-headers.py requires print_function
148 tests/get-with-headers.py requires print_function
150 tests/heredoctest.py not using absolute_import
149 tests/heredoctest.py not using absolute_import
151 tests/heredoctest.py requires print_function
150 tests/heredoctest.py requires print_function
General Comments 0
You need to be logged in to leave comments. Login now