audreyfeldroy / complexity

A refreshingly simple static site generator, for those who like to work in HTML.
Other
118 stars 32 forks source link

Better handling of empty context/*.json files #26

Open audreyfeldroy opened 11 years ago

audreyfeldroy commented 11 years ago

If a context json file is empty, you get:

Traceback (most recent call last):
  File "/home/travis/build/audreyr/complexity/tests/test_main.py", line 43, in test_conf_proj2_with_complexity
    main.complexity('tests/conf_proj2')
  File "/home/travis/build/audreyr/complexity/complexity/main.py", line 66, in complexity
    context = generate_context(context_dir)
  File "/home/travis/build/audreyr/complexity/complexity/generate.py", line 167, in generate_context
    obj = json.load(f)
  File "/usr/lib/python3.3/json/__init__.py", line 274, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.3/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.3/json/decoder.py", line 352, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.3/json/decoder.py", line 370, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded