mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-10-30 17:47:50 +00:00
@@ -3,9 +3,8 @@ python:
|
|||||||
- "3.6"
|
- "3.6"
|
||||||
# command to install dependencies
|
# command to install dependencies
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements.txt
|
- python setup.py install
|
||||||
# command to run tests
|
# command to run tests
|
||||||
before_script:
|
before_script:
|
||||||
- export PYTHONPATH=$PYTHONPATH:/home/travis/build/Orange-OpenSource/gnpy/examples
|
|
||||||
script:
|
script:
|
||||||
- pytest
|
- pytest
|
||||||
|
|||||||
@@ -187,8 +187,8 @@ implementations.
|
|||||||
:alt: Documentation Status
|
:alt: Documentation Status
|
||||||
:scale: 100%
|
:scale: 100%
|
||||||
|
|
||||||
.. |build| image:: https://travis-ci.org/mcantono/gnpy.svg?branch=develop
|
.. |build| image:: https://travis-ci.org/Telecominfraproject/oopt-gnpy.svg?branch=develop
|
||||||
:target: https://travis-ci.org/mcantono/gnpy
|
:target: https://travis-ci.org/Telecominfraproject/oopt-gnpy
|
||||||
:alt: Build Status
|
:alt: Build Status
|
||||||
:scale: 100%
|
:scale: 100%
|
||||||
|
|
||||||
|
|||||||
3
hooks/pre-commit
Executable file
3
hooks/pre-commit
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
exec pytest
|
||||||
BIN
tests/CORONET_Global_Topology.xls
Normal file
BIN
tests/CORONET_Global_Topology.xls
Normal file
Binary file not shown.
@@ -15,7 +15,8 @@ from examples.compare_json import compare_network_file, compare_service_file, co
|
|||||||
from gnpy.core.convert import convert_file
|
from gnpy.core.convert import convert_file
|
||||||
from examples.convert_service_sheet import convert_service_sheet
|
from examples.convert_service_sheet import convert_service_sheet
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import filecmp
|
import filecmp
|
||||||
|
from os import unlink
|
||||||
|
|
||||||
|
|
||||||
network_file_name = 'tests/test_network.json'
|
network_file_name = 'tests/test_network.json'
|
||||||
@@ -23,30 +24,32 @@ eqpt_library_name = 'examples/eqpt_config.json'
|
|||||||
|
|
||||||
# adding tests to check the parser non regression
|
# adding tests to check the parser non regression
|
||||||
# convention of naming of test files:
|
# convention of naming of test files:
|
||||||
#
|
#
|
||||||
# - ..._expected.json for the reference output
|
# - ..._expected.json for the reference output
|
||||||
|
|
||||||
excel_filename = ['tests/excelTestFile.xls',
|
excel_filename = ['tests/excelTestFile.xls',
|
||||||
'examples/CORONET_Global_Topology.xls',
|
'tests/CORONET_Global_Topology.xls',
|
||||||
'tests/meshTopologyExampleV2.xls',
|
'tests/meshTopologyExampleV2.xls',
|
||||||
'tests/meshTopologyExampleV2Eqpt.xls']
|
'tests/meshTopologyExampleV2Eqpt.xls']
|
||||||
network_test_filenames = {
|
network_test_filenames = {
|
||||||
'tests/excelTestFile.xls' : 'tests/excelTestFile_expected.json',
|
'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/meshTopologyExampleV2.xls' : 'tests/meshTopologyExampleV2_expected.json',
|
||||||
'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_expected.json'}
|
'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_expected.json'}
|
||||||
@pytest.mark.parametrize("inputfile",excel_filename)
|
@pytest.mark.parametrize("inputfile",excel_filename)
|
||||||
def test_excel_json_generation(inputfile) :
|
def test_excel_json_generation(inputfile) :
|
||||||
convert_file(Path(inputfile))
|
convert_file(Path(inputfile))
|
||||||
# actual
|
# actual
|
||||||
json_filename = f'{inputfile[:-3]}json'
|
json_filename = f'{inputfile[:-3]}json'
|
||||||
# expected
|
# expected
|
||||||
expected_filename = network_test_filenames[inputfile]
|
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
|
# assume json entries
|
||||||
# test that the build network gives correct results
|
# test that the build network gives correct results
|
||||||
# TODO !!
|
# TODO !!
|
||||||
|
|
||||||
excel_filename = ['tests/excelTestFile.xls',
|
excel_filename = ['tests/excelTestFile.xls',
|
||||||
@@ -58,10 +61,12 @@ service_test_filenames = {
|
|||||||
'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_services_expected.json'}
|
'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_services_expected.json'}
|
||||||
@pytest.mark.parametrize("inputfile",excel_filename)
|
@pytest.mark.parametrize("inputfile",excel_filename)
|
||||||
def test_excel_service_json_generation(inputfile) :
|
def test_excel_service_json_generation(inputfile) :
|
||||||
convert_service_sheet(Path(inputfile),eqpt_library_name)
|
convert_service_sheet(Path(inputfile),eqpt_library_name)
|
||||||
# actual
|
# actual
|
||||||
json_filename = f'{inputfile[:-4]}_services.json'
|
json_filename = f'{inputfile[:-4]}_services.json'
|
||||||
# expected
|
# expected
|
||||||
test_filename = service_test_filenames[inputfile]
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user