|
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +# Copyright (c) 2021 LG Electronics Inc. |
| 4 | +# SPDX-License-Identifier: Apache-2.0 |
| 5 | +import os |
| 6 | +import pytest |
| 7 | +import subprocess |
| 8 | + |
| 9 | +DIST_PATH = os.path.join(os.environ.get("TOX_PATH"), "dist", "cli.exe") |
| 10 | + |
| 11 | + |
| 12 | +@pytest.mark.parametrize("input_path, output_path", [ |
| 13 | + ("tests/test_gradle/jib", "tests/result/gradle"), |
| 14 | + ("tests/test_gradle2", "tests/result/gradle2") |
| 15 | +]) |
| 16 | +@pytest.mark.ubuntu |
| 17 | +def test_ubuntu(input_path, output_path): |
| 18 | + command = f"fosslight_dependency -p {input_path} -o {output_path}" |
| 19 | + result = subprocess.run(command, shell=True, capture_output=True, text=True) |
| 20 | + assert result.returncode == 0, f"Command failed: {command}\nstdout: {result.stdout}\nstderr: {result.stderr}" |
| 21 | + assert any(os.scandir(output_path)), f"Output file does not exist: {output_path}" |
| 22 | + |
| 23 | + |
| 24 | +@pytest.mark.parametrize("input_path, output_path", [ |
| 25 | + (os.path.join("tests", "test_gradle", "jib"), os.path.join("tests", "result", "gradle")), |
| 26 | + (os.path.join("tests", "test_gradle2"), os.path.join("tests", "result", "gradle2")) |
| 27 | +]) |
| 28 | +@pytest.mark.windows |
| 29 | +def test_windows(input_path, output_path): |
| 30 | + command = f"{DIST_PATH} -p {input_path} -o {output_path} -m gradle" |
| 31 | + result = subprocess.run(command, capture_output=True, text=True) |
| 32 | + assert result.returncode == 0, f"Command failed: {command}\nstdout: {result.stdout}\nstderr: {result.stderr}" |
| 33 | + assert any(os.scandir(output_path)), f"Output file does not exist: {output_path}" |
0 commit comments