mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
Fixed fixture loading on Windows.
This commit is contained in:
1 parent
84a521a827
commit
bbc820bf2e
2 files changed
+10
-9
No files matched your search
Vendored
+9
-7
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
import codecs
|
||||
|
||||
from tests import TESTS_ROOT
|
||||
from httpie.compat import bytes
|
||||
|
||||
|
||||
def patharg(path):
|
||||
@@ -18,15 +18,17 @@ FILE_PATH_ARG = patharg(FILE_PATH)
|
||||
BIN_FILE_PATH_ARG = patharg(BIN_FILE_PATH)
|
||||
JSON_FILE_PATH_ARG = patharg(JSON_FILE_PATH)
|
||||
|
||||
with open(FILE_PATH) as f:
|
||||
|
||||
with codecs.open(FILE_PATH, encoding='utf8') as f:
|
||||
# Strip because we don't want new lines in the data so that we can
|
||||
# easily count occurrences also when embedded in JSON (where the new
|
||||
# line would be escaped).
|
||||
FILE_CONTENT = f.read().strip()
|
||||
if isinstance(FILE_CONTENT, bytes):
|
||||
# Python < 3.0
|
||||
FILE_CONTENT = FILE_CONTENT.decode('utf8')
|
||||
|
||||
|
||||
with codecs.open(JSON_FILE_PATH, encoding='utf8') as f:
|
||||
JSON_FILE_CONTENT = f.read()
|
||||
|
||||
|
||||
with open(BIN_FILE_PATH, 'rb') as f:
|
||||
BIN_FILE_CONTENT = f.read()
|
||||
with open(JSON_FILE_PATH, 'rb') as f:
|
||||
JSON_FILE_CONTENT = f.read()
|
||||
Reference in new issue
Block a user