Skip to content
Snippets Groups Projects
Commit 57464f60 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

hopefully fix coverage + add ujson support

parent a13e41ad
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ before_script:
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- pip install -r requirements.txt
- pip install coverage nose2 requests
- pip install coverage nose2
jobs:
include:
- stage: test
......
# v2.8.12
* added optional `ujson` support
......@@ -37,6 +37,10 @@ Then there are abstract sources of configuration.
In order to actually load the configuration, use the method ``provide()``.
Note that `FileSource` will try parsing the file with any modules, available, so if you
want parsing for **yaml** and **toml**, you better install `pyyaml` and `toml` respectively.
Note that JSON will be parsed using `ujson` if the module is available.
JSON schema
-----------
......
__version__ = '2.8.12_a1'
__version__ = '2.8.12_a2'
import binascii
import codecs
import json
import typing as tb
from satella.coding.recast_exceptions import rethrow_as
......@@ -60,14 +59,26 @@ class FormatSource(BaseSource):
else:
return ret_val
try:
import ujson
@register_format_source
class JSONSource(FormatSource):
"""
Loads JSON strings
"""
TRANSFORM = json.loads
EXTRA_EXCEPTIONS = [json.JSONDecodeError]
@register_format_source
class JSONSource(FormatSource):
"""
Loads JSON strings
"""
TRANSFORM = ujson.loads
EXTRA_EXCEPTIONS = [ValueError]
except ImportError:
import json
@register_format_source
class JSONSource(FormatSource):
"""
Loads JSON strings
"""
TRANSFORM = json.loads
EXTRA_EXCEPTIONS = [json.JSONDecodeError]
try:
......
......@@ -9,7 +9,7 @@ setup(keywords=['ha', 'high availability', 'scalable', 'scalability', 'server',
'psutil'
],
tests_require=[
"nose2", "mock", "coverage", "nose2[coverage_plugin]", "requests"
"nose2", "mock", "coverage"
],
test_suite='nose2.collector.collector',
python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
......@@ -17,6 +17,7 @@ setup(keywords=['ha', 'high availability', 'scalable', 'scalability', 'server',
'HTTPJSONSource': ['requests'],
'YAMLSource': ['pyyaml'],
'TOMLSource': ['toml'],
'Faster JSONSource': ['ujson'],
'satella.cassandra': ['cassandra-driver']
}
)
[coverage]
always-on = True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment