Add coverage with nose2 and coveralls
parent
92bc82be15
commit
ac05fd4fd0
|
|
@ -0,0 +1,2 @@
|
|||
repo_token: 6xTyVRsaxpM3PkeCgjhqPu51CaBumfNia
|
||||
service_name: travis-ci
|
||||
|
|
@ -14,4 +14,5 @@ MANIFEST.in
|
|||
setup.py
|
||||
scripts/logs/*
|
||||
logs/*
|
||||
.coverage
|
||||
mycroft/audio-accuracy-test/data/*
|
||||
|
|
|
|||
|
|
@ -10,10 +10,15 @@ cache: pocketsphinx-python
|
|||
install:
|
||||
- VIRTUALENV_ROOT=${VIRTUAL_ENV} ./dev_setup.sh
|
||||
- pip install -r requirements.txt
|
||||
- pip install nose2 cov-core
|
||||
- pip install python-coveralls
|
||||
# - pip install -r test-requirements.txt
|
||||
# command to run tests
|
||||
script:
|
||||
- pep8 mycroft test
|
||||
- ./start.sh unittest --fail-on-error
|
||||
- nose2 test --with-coverage --config=test/unittest.cfg
|
||||
env:
|
||||
- IS_TRAVIS=true
|
||||
|
||||
after_success:
|
||||
coveralls
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Mycroft [](https://travis-ci.org/MycroftAI/mycroft-core)
|
||||
Mycroft [](https://travis-ci.org/MycroftAI/mycroft-core) [](https://coveralls.io/github/MycroftAI/mycroft-core?branch=dev)
|
||||
==========
|
||||
|
||||
NOTE: The default branch for this repo is dev. This should be considered a working beta. If you want to clone a more stable version, switch over to the 'master' branch.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
[unittest]
|
||||
test-file-pattern=*.py
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
from os.path import dirname, join
|
||||
import unittest
|
||||
import json
|
||||
from mycroft.util.json_helper import load_commented_json, uncomment_json
|
||||
|
|
@ -6,12 +7,15 @@ from mycroft.util.json_helper import load_commented_json, uncomment_json
|
|||
class TestFileLoad(unittest.TestCase):
|
||||
|
||||
def test_load(self):
|
||||
root_dir = dirname(__file__)
|
||||
# Load normal JSON file
|
||||
with open('plain.json', 'rw') as f:
|
||||
plainfile = join(root_dir, 'plain.json')
|
||||
with open(plainfile, 'rw') as f:
|
||||
data_from_plain = json.load(f)
|
||||
|
||||
# Load commented JSON file
|
||||
data_from_commented = load_commented_json('commented.json')
|
||||
commentedfile = join(root_dir, 'commented.json')
|
||||
data_from_commented = load_commented_json(commentedfile)
|
||||
|
||||
# Should be the same...
|
||||
self.assertEqual(data_from_commented, data_from_plain)
|
||||
|
|
|
|||
Loading…
Reference in New Issue