small test fixes

This commit is contained in:
James Powell
2018-06-22 18:55:26 -04:00
parent 4304b49bf0
commit d33602e131
5 changed files with 22 additions and 15 deletions

View File

@@ -3,9 +3,8 @@ python:
- "3.6"
# command to install dependencies
install:
- pip install -r requirements.txt
- python setup.py install
# command to run tests
before_script:
- export PYTHONPATH=$PYTHONPATH:/home/travis/build/Orange-OpenSource/gnpy/examples
script:
- pytest

View File

@@ -187,8 +187,8 @@ implementations.
:alt: Documentation Status
:scale: 100%
.. |build| image:: https://travis-ci.org/mcantono/gnpy.svg?branch=develop
:target: https://travis-ci.org/mcantono/gnpy
.. |build| image:: https://travis-ci.org/Telecominfraproject/oopt-gnpy.svg?branch=develop
:target: https://travis-ci.org/Telecominfraproject/oopt-gnpy
:alt: Build Status
:scale: 100%

3
hooks/pre-commit Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec pytest

Binary file not shown.

View File

@@ -16,6 +16,7 @@ from gnpy.core.convert import convert_file
from examples.convert_service_sheet import convert_service_sheet
from pathlib import Path
import filecmp
from os import unlink
network_file_name = 'tests/test_network.json'
@@ -27,12 +28,12 @@ eqpt_library_name = 'examples/eqpt_config.json'
# - ..._expected.json for the reference output
excel_filename = ['tests/excelTestFile.xls',
'examples/CORONET_Global_Topology.xls',
'tests/CORONET_Global_Topology.xls',
'tests/meshTopologyExampleV2.xls',
'tests/meshTopologyExampleV2Eqpt.xls']
network_test_filenames = {
'tests/excelTestFile.xls' : 'tests/excelTestFile_expected.json',
'examples/CORONET_Global_Topology.xls': 'tests/CORONET_Global_Topology_expected.json',
'tests/CORONET_Global_Topology.xls' : 'tests/CORONET_Global_Topology_expected.json',
'tests/meshTopologyExampleV2.xls' : 'tests/meshTopologyExampleV2_expected.json',
'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_expected.json'}
@pytest.mark.parametrize("inputfile",excel_filename)
@@ -43,7 +44,9 @@ def test_excel_json_generation(inputfile) :
# expected
expected_filename = network_test_filenames[inputfile]
assert compare_network_file(expected_filename,json_filename)[0] is True
result, _ = compare_network_file(expected_filename, json_filename)
unlink(json_filename)
assert result
# assume json entries
# test that the build network gives correct results
@@ -64,4 +67,6 @@ def test_excel_service_json_generation(inputfile) :
# expected
test_filename = service_test_filenames[inputfile]
assert compare_service_file(test_filename,json_filename)[0] is True
result, _ = compare_service_file(test_filename, json_filename)
unlink(json_filename)
assert result