Skip to content

Commit

Permalink
Add coveralls to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
aguinane committed Dec 19, 2017
1 parent eb3924e commit 1331ab5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -3,7 +3,8 @@ language: python
python:
- "3.6"
# command to run tests
install: pip install tox-travis
install:
- pip install tox-travis coveralls
script: tox -e $(echo py$TRAVIS_PYTHON_VERSION | tr -d .)
after_success:
- coveralls
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# nem-reader

[![Build Status](https://travis-ci.org/aguinane/nem-reader.svg?branch=master)](https://travis-ci.org/aguinane/nem-reader)
[![Build Status](https://travis-ci.org/aguinane/nem-reader.svg?branch=master)](https://travis-ci.org/aguinane/nem-reader) [![Coverage Status](https://coveralls.io/repos/github/aguinane/nem-reader/badge.svg)](https://coveralls.io/github/aguinane/nem-reader)

The Australian Energy Market Operator (AEMO) defines a Meter Data File Format (MDFF) for reading energy billing data.
[MDFF Specification](https://www.aemo.com.au/Stakeholder-Consultation/Consultations/Meter-Data-File-Format-Specification-NEM12-and-NEM13)
Expand Down
72 changes: 36 additions & 36 deletions tests/test_actual_interval.py
@@ -1,36 +1,36 @@
""" Test Suite
"""

import pytest
import os
import sys
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')))
import nemreader as nr


def test_correct_NMIs():
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv')
assert len(meter_data.readings) == 1
assert 'VABD000163' in meter_data.readings

def test_correct_channels():
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv')
readings = meter_data.readings['VABD000163']
assert len(readings) == 2
assert 'E1' in readings
assert 'Q1' in readings

def test_correct_records():
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv')
readings = meter_data.readings['VABD000163']

assert len(readings['E1']) == 48
assert readings['E1'][10].read_value == pytest.approx(1.11, 0.1)
assert readings['E1'][-1].read_value == pytest.approx(1.11, 0.1)

assert len(readings['Q1']) == 48
assert readings['Q1'][10].read_value == pytest.approx(2.22, 0.1)
assert readings['Q1'][-1].read_value == pytest.approx(2.22, 0.1)
assert readings['Q1'][-1].quality_method == 'A'
""" Test Suite
"""

import pytest
import os
import sys
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')))
import nemreader as nr


def test_correct_NMIs():
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv')
assert len(meter_data.readings) == 1
assert 'VABD000163' in meter_data.readings

def test_correct_channels():
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv')
readings = meter_data.readings['VABD000163']
assert len(readings) == 2
assert 'E1' in readings
assert 'Q1' in readings

def test_correct_records():
meter_data = nr.read_nem_file('examples/unzipped/Example_NEM12_actual_interval.csv')
readings = meter_data.readings['VABD000163']

assert len(readings['E1']) == 48
assert readings['E1'][10].read_value == pytest.approx(1.11, 0.1)
assert readings['E1'][-1].read_value == pytest.approx(1.11, 0.1)

assert len(readings['Q1']) == 48
assert readings['Q1'][10].read_value == pytest.approx(2.22, 0.1)
assert readings['Q1'][-1].read_value == pytest.approx(2.22, 0.1)
assert readings['Q1'][-1].quality_method == 'A'

14 changes: 2 additions & 12 deletions tox.ini
@@ -1,26 +1,16 @@
[tox]
envlist =
py{34,36},
coverage,
skip_missing_interpreters =
true

[testenv]
# Default environment
deps =
-r{toxinidir}/requirements.txt
pytest
pytest-sugar
pytest-xdist
commands =
py.test

[testenv:coverage]
# Generates coverage report
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps =
-r{toxinidir}/requirements.txt
pytest
pytest-sugar
pytest-cov
commands =
py.test --cov-report term-missing --cov=nemreader tests/
py.test -v --cov=nemreader

0 comments on commit 1331ab5

Please sign in to comment.