Skip to content

Commit

Permalink
bugfix: python2.7 unit test fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Feb 11, 2017
1 parent 043a6b9 commit e5eaff5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/test_packages_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def test_package_cache(tmpdir):
"uranium_standalone", "--uranium-dir", URANIUM_SOURCE_ROOT,
cwd=tmpdir.strpath
)
print(out)
print(err)
assert "Requirement already satisified" not in str(out)
assert code == 0

Expand Down
7 changes: 4 additions & 3 deletions uranium/history.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
from .lib.utils import ensure_file
from .lib.compat import str_type
from .exceptions import HistoryException


Expand Down Expand Up @@ -34,11 +35,11 @@ def load(self):
def assert_is_serializable(obj):
if isinstance(obj, dict):
for k, v in obj.items():
if not isinstance(k, str):
raise HistoryException("unable to serialize dictionary with not-string key {0}".format(str(k)))
if not isinstance(k, str_type):
raise HistoryException("unable to serialize dictionary with non-string key {0}".format(str(k)))
assert_is_serializable(v)
elif isinstance(obj, list):
for o in obj:
assert_is_serializable(o)
elif not isinstance(obj, (str, int, float, bool)):
elif not isinstance(obj, (str_type, int, float, bool)):
raise HistoryException("unable to serialize type {0}".format(type(obj)))

0 comments on commit e5eaff5

Please sign in to comment.