diff --git a/.travis.yml b/.travis.yml index bc6ebc20..99f39951 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/README.rst b/README.rst index 820a05a0..da9e20f5 100644 --- a/README.rst +++ b/README.rst @@ -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% diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100755 index 00000000..a0c56c89 --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,3 @@ +#!/bin/sh + +exec pytest diff --git a/tests/CORONET_Global_Topology.xls b/tests/CORONET_Global_Topology.xls new file mode 100644 index 00000000..952d008b Binary files /dev/null and b/tests/CORONET_Global_Topology.xls differ diff --git a/tests/parsers_test.py b/tests/parsers_test.py index 156edfc5..a5c69505 100644 --- a/tests/parsers_test.py +++ b/tests/parsers_test.py @@ -15,7 +15,8 @@ from examples.compare_json import compare_network_file, compare_service_file, co from gnpy.core.convert import convert_file from examples.convert_service_sheet import convert_service_sheet from pathlib import Path -import filecmp +import filecmp +from os import unlink 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 # convention of naming of test files: -# +# # - ..._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) def test_excel_json_generation(inputfile) : - convert_file(Path(inputfile)) + convert_file(Path(inputfile)) # actual json_filename = f'{inputfile[:-3]}json' # 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 +# test that the build network gives correct results # TODO !! excel_filename = ['tests/excelTestFile.xls', @@ -58,10 +61,12 @@ service_test_filenames = { 'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_services_expected.json'} @pytest.mark.parametrize("inputfile",excel_filename) def test_excel_service_json_generation(inputfile) : - convert_service_sheet(Path(inputfile),eqpt_library_name) + convert_service_sheet(Path(inputfile),eqpt_library_name) # actual json_filename = f'{inputfile[:-4]}_services.json' # expected test_filename = service_test_filenames[inputfile] - - assert compare_service_file(test_filename,json_filename)[0] is True \ No newline at end of file + + result, _ = compare_service_file(test_filename, json_filename) + unlink(json_filename) + assert result