diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 247b2f13..cd29a7f1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,3 +89,22 @@ jobs: push: true tags: | telecominfraproject/oopt-gnpy:${{ steps.extract_tag_name.outputs.GIT_DESC }} + + windows: + name: Tests on Windows + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python_version }} + - run: | + pip install --editable . + pip install 'pytest>=5.0.0,<6' + pytest -vv + strategy: + matrix: + python_version: + - "3.9" diff --git a/gnpy/tools/cli_examples.py b/gnpy/tools/cli_examples.py index 5dfa9212..fb311ed7 100644 --- a/gnpy/tools/cli_examples.py +++ b/gnpy/tools/cli_examples.py @@ -306,7 +306,6 @@ def path_requests_run(args=None): _setup_logging(args) _logger.info(f'Computing path requests {args.service_filename} into JSON format') - print(f'{ansi_escapes.blue}Computing path requests {os.path.relpath(args.service_filename)} into JSON format{ansi_escapes.reset}') (equipment, network) = load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign) diff --git a/tests/invocation/path_requests_run b/tests/invocation/path_requests_run index b75a0c6a..78348ce9 100644 --- a/tests/invocation/path_requests_run +++ b/tests/invocation/path_requests_run @@ -1,4 +1,3 @@ -Computing path requests gnpy/example-data/meshTopologyExampleV2.xls into JSON format List of disjunctions [Disjunction 3 relaxable: false diff --git a/tests/test_invocation.py b/tests/test_invocation.py index 0c100011..66bf3cd4 100644 --- a/tests/test_invocation.py +++ b/tests/test_invocation.py @@ -17,14 +17,14 @@ SRC_ROOT = Path(__file__).parent.parent ('openroadm-Stockholm-Gothenburg', transmission_main_example, ['-e', 'gnpy/example-data/eqpt_config_openroadm.json', 'gnpy/example-data/Sweden_OpenROADM_example_network.json', ]), )) -def test_example_invocation(capfdbinary, output, handler, args): +def test_example_invocation(capfd, output, handler, args): '''Make sure that our examples produce useful output''' os.chdir(SRC_ROOT) - expected = open(SRC_ROOT / 'tests' / 'invocation' / output, mode='rb').read() + expected = open(SRC_ROOT / 'tests' / 'invocation' / output, mode='r', encoding='utf-8').read() handler(args) - captured = capfdbinary.readouterr() - assert captured.out.decode('utf-8') == expected.decode('utf-8') - assert captured.err == b'' + captured = capfd.readouterr() + assert captured.out == expected + assert captured.err == '' @pytest.mark.parametrize('program', ('gnpy-transmission-example', 'gnpy-path-request')) @@ -39,7 +39,7 @@ def test_run_wrapper(program): def test_conversion_xls(): proc = subprocess.run( - ('gnpy-convert-xls', SRC_ROOT / 'tests' / 'data' / 'testTopology.xls', '--output', '/dev/null'), + ('gnpy-convert-xls', SRC_ROOT / 'tests' / 'data' / 'testTopology.xls', '--output', os.path.devnull), stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, universal_newlines=True) assert proc.stderr == '' - assert '/dev/null' in proc.stdout + assert os.path.devnull in proc.stdout