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