Skip to content

Commit

Permalink
upgraded compatibility to 3.4 and pypy
Browse files Browse the repository at this point in the history
  • Loading branch information
manuphatak committed Apr 14, 2015
1 parent 75b3a86 commit 731fd19
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions json_config/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def connect(config_file_):
try:
config.update(json.load(open(config_file), object_hook=json_hook))
except IOError:
open(config_file, 'w').close()
with open(config_file, 'w') as f:
f.close()

return config

Expand Down Expand Up @@ -59,8 +60,8 @@ def _wrapper(self, *args, **kwargs):
return func(self, *args, **kwargs)

finally:
json.dump(config, open(config_file, 'wb'), indent=2, sort_keys=True,
separators=(',', ': '))
with open(config_file, 'w') as f:
json.dump(config, f, indent=2, sort_keys=True, separators=(',', ': '))

return _wrapper

Expand All @@ -73,7 +74,6 @@ def __setitem__(self, key, value):


def __getitem__(self, key):
print key
return super(Configuration, self).__getitem__(key)

@save_config
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pytest
wheel
Sphinx
wheel
2 changes: 1 addition & 1 deletion test/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_abc_magic_methods_length():

def test_abc_magic_methods_iter(config):
iter_config = list(config)
assert iter_config == ['test', 'cat_1', 'cat_2', 'cat_3']
assert set(iter_config) == {'test', 'cat_1', 'cat_2', 'cat_3'}


def test_abc_magic_methods_getitem(config):
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[tox]
envlist = py27, py34, pypy, style, docs
envlist = py27, py34, pypy, docs
basepython=python2.7

[testenv]
commands =
python setup.py test
{envpython} setup.py test
setenv=
PYTHONWARNINGS=all

Expand All @@ -12,7 +13,7 @@ deps =
-r{toxinidir}/requirements.txt
flake8
commands =
python setup.py flake8
flake8

[testenv:docs]
whitelist_externals = make
Expand Down

0 comments on commit 731fd19

Please sign in to comment.