Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
package_control_channel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
package_control_channel
Commits
66914538
Commit
66914538
authored
Feb 29, 2016
by
wbond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reject improperly-encoded JSON files
parent
300bd63d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
test.py
tests/test.py
+6
-6
No files found.
tests/test.py
View file @
66914538
...
...
@@ -581,11 +581,11 @@ class TestContainer(object):
except
Exception
as
e
:
yield
cls
.
_fail
(
"Downloading
%
s failed"
%
path
,
e
)
return
source
=
source
.
decode
(
"utf-8"
,
'
replace
'
)
source
=
source
.
decode
(
"utf-8"
,
'
strict
'
)
else
:
try
:
with
_open
(
path
)
as
f
:
source
=
f
.
read
()
.
decode
(
'utf-8'
,
'
replace
'
)
source
=
f
.
read
()
.
decode
(
'utf-8'
,
'
strict
'
)
except
Exception
as
e
:
yield
cls
.
_fail
(
"Opening
%
s failed"
%
path
,
e
)
return
...
...
@@ -685,7 +685,7 @@ class DefaultChannelTests(TestContainer, unittest.TestCase):
def
pre_generate
(
cls
):
if
not
hasattr
(
cls
,
'j'
):
with
_open
(
'channel.json'
)
as
f
:
cls
.
source
=
f
.
read
()
.
decode
(
'utf-8'
,
'
replace
'
)
cls
.
source
=
f
.
read
()
.
decode
(
'utf-8'
,
'
strict
'
)
cls
.
j
=
json
.
loads
(
cls
.
source
)
from
collections
import
defaultdict
...
...
@@ -754,7 +754,7 @@ class DefaultRepositoryTests(TestContainer, unittest.TestCase):
def
pre_generate
(
cls
):
if
not
hasattr
(
cls
,
'j'
):
with
_open
(
'repository.json'
)
as
f
:
cls
.
source
=
f
.
read
()
.
decode
(
'utf-8'
,
'
replace
'
)
cls
.
source
=
f
.
read
()
.
decode
(
'utf-8'
,
'
strict
'
)
cls
.
j
=
json
.
loads
(
cls
.
source
)
def
test_repository_keys
(
self
):
...
...
@@ -778,10 +778,10 @@ class DefaultRepositoryTests(TestContainer, unittest.TestCase):
for
include
in
cls
.
j
[
'includes'
]:
try
:
with
_open
(
include
)
as
f
:
contents
=
f
.
read
()
.
decode
(
'utf-8'
,
'
replace
'
)
contents
=
f
.
read
()
.
decode
(
'utf-8'
,
'
strict
'
)
data
=
json
.
loads
(
contents
)
except
Exception
as
e
:
yield
cls
.
_fail
(
"
Error
while reading
%
r"
%
include
,
e
)
yield
cls
.
_fail
(
"
strict
while reading
%
r"
%
include
,
e
)
continue
# `include` is for output during tests only
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment