-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor existing tox test to pytest #225
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2f6d816
create test files
YongGoose 8d2092c
refactor run_ubuntu test codes
YongGoose d4479e5
rename constant value
YongGoose aeadbbc
refactor test codes
YongGoose 7cb322d
generate windows test code
YongGoose ba9f209
Resolve not found exception
YongGoose 776c86e
Change path separator
YongGoose 9b6bb9a
Fix commands in tox
YongGoose 30f7c36
Add license information
YongGoose b8c8c3f
Add custom marker for window and ubuntu
YongGoose 36952e7
Add flake8 test
YongGoose 8a66741
Add blank line
YongGoose adc3862
Refactor tests
YongGoose 91ca53d
Remove comma
YongGoose f02c365
Remove shell option
YongGoose 48d68c9
Add shell option in ubuntu tests
YongGoose 4271610
Remove useless library in requirements.txt
YongGoose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
flake8==3.9.2 | ||
pyinstaller | ||
pyinstaller>=6.10.0 | ||
tox>=4.18.1 | ||
pytest | ||
pytest-cov | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ requirements-parser | |
defusedxml | ||
packageurl-python | ||
igraph | ||
matplotlib | ||
matplotlib |
YongGoose marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2021 LG Electronics Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import os | ||
import shutil | ||
import pytest | ||
|
||
set_up_directories = [ | ||
"tests/result/android", | ||
"tests/result/cocoapods", | ||
"tests/result/exclude", | ||
"tests/result/gradle", | ||
"tests/result/gradle2", | ||
"tests/result/helm", | ||
"tests/result/maven1", | ||
"tests/result/maven2", | ||
"tests/result/multi_pypi_npm", | ||
"tests/result/npm1", | ||
"tests/result/npm2", | ||
"tests/result/nuget1", | ||
"tests/result/nuget2", | ||
"tests/result/pub", | ||
"tests/result/pypi" | ||
] | ||
|
||
remove_directories = set_up_directories | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def setup_test_result_dir_and_teardown(): | ||
print("==============setup==============") | ||
for directory in set_up_directories: | ||
os.makedirs(directory, exist_ok=True) | ||
|
||
yield | ||
|
||
print("==============tearDown==============") | ||
for directory in remove_directories: | ||
shutil.rmtree(directory) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/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") | ||
YongGoose marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
@pytest.mark.parametrize("input_path, output_path, extra_args", [ | ||
("tests/test_android", "tests/result/android", "-m android") | ||
]) | ||
@pytest.mark.ubuntu | ||
def test_ubuntu(input_path, output_path, extra_args): | ||
command = f"fosslight_dependency -p {input_path} -o {output_path} {extra_args}" | ||
result = subprocess.run(command, shell=True, capture_output=True, text=True) | ||
YongGoose marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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_android", "sunflower"), os.path.join("tests", "result", "android")) | ||
]) | ||
@pytest.mark.windows | ||
def test_windows(input_path, output_path): | ||
command = f"{DIST_PATH} -p {input_path} -o {output_path}" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/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 | ||
|
||
|
||
@pytest.mark.parametrize("input_path, output_path, extra_args", [ | ||
("tests/test_cocoapods", "tests/result/cocoapods", "-m cocoapods") | ||
]) | ||
@pytest.mark.ubuntu | ||
def test_ubuntu(input_path, output_path, extra_args): | ||
command = f"fosslight_dependency -p {input_path} -o {output_path} {extra_args}" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/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 | ||
|
||
|
||
@pytest.mark.parametrize("input_path, output_path, extra_args", [ | ||
("tests/test_helm", "tests/result/helm", "-m helm") | ||
]) | ||
@pytest.mark.ubuntu | ||
def test_ubuntu(input_path, output_path, extra_args): | ||
command = f"fosslight_dependency -p {input_path} -o {output_path} {extra_args}" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/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_maven1/lombok.maven", "tests/result/maven1"), | ||
("tests/test_maven2", "tests/result/maven2") | ||
]) | ||
@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_maven2"), os.path.join("tests", "result", "maven2")) | ||
]) | ||
@pytest.mark.windows | ||
def test_windows(input_path, output_path): | ||
command = f"{DIST_PATH} -p {input_path} -o {output_path} -m maven" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/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 | ||
|
||
|
||
@pytest.mark.parametrize("input_path, output_path, extra_args", [ | ||
("tests/test_npm1", "tests/result/npm1", ""), | ||
("tests/test_npm2", "tests/result/npm2", "-m npm") | ||
]) | ||
@pytest.mark.ubuntu | ||
def test_ubuntu(input_path, output_path, extra_args): | ||
command = f"fosslight_dependency -p {input_path} -o {output_path} {extra_args}" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/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 | ||
|
||
UBUNTU_COMMANDS = [ | ||
"fosslight_dependency -p tests/test_nuget -o tests/result/nuget1", | ||
"fosslight_dependency -p tests/test_nuget2 -o tests/result/nuget2" | ||
] | ||
|
||
DIST_PATH = os.path.join(os.environ.get("TOX_PATH"), "dist", "cli.exe") | ||
|
||
|
||
@pytest.mark.parametrize("input_path, output_path", [ | ||
("tests/test_nuget", "tests/result/nuget1"), | ||
("tests/test_nuget2", "tests/result/nuget2") | ||
]) | ||
@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_nuget"), os.path.join("tests", "result", "nuget1")), | ||
(os.path.join("tests", "test_nuget2"), os.path.join("tests", "result", "nuget2")) | ||
]) | ||
@pytest.mark.windows | ||
def test_windows(input_path, output_path): | ||
command = f"{DIST_PATH} -p {input_path} -o {output_path}" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/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_pub", "tests/result/pub"), | ||
("tests/test_exclude -e requirements.txt", "tests/result/exclude") | ||
]) | ||
@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, extra_args", [ | ||
(os.path.join("tests", "test_pub"), os.path.join("tests", "result", "pub"), ""), | ||
(os.path.join("tests", "test_pub"), os.path.join("tests", "result", "pub"), "-f opossum"), | ||
(os.path.join("tests", "test_exclude") + " -e requirements.txt", os.path.join("tests", "result", "exclude"), "") | ||
]) | ||
@pytest.mark.windows | ||
def test_windows(input_path, output_path, extra_args): | ||
command = f"{DIST_PATH} -p {input_path} -o {output_path} {extra_args}" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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, extra_args", [ | ||
("tests/test_pypi", "tests/result/pypi", ""), | ||
("tests/test_multi_pypi_npm", "tests/result/multi_pypi_npm", ""), | ||
("tests/test_multi_pypi_npm", "tests/result/multi_pypi_npm", "-f opossum") | ||
]) | ||
@pytest.mark.ubuntu | ||
def test_ubuntu(input_path, output_path, extra_args): | ||
command = f"fosslight_dependency -p {input_path} -o {output_path} {extra_args}" | ||
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_pypi"), os.path.join("tests", "result", "pypi")) | ||
]) | ||
@pytest.mark.windows | ||
def test_windows(input_path, output_path): | ||
command = f"{DIST_PATH} -p {input_path} -o {output_path}" | ||
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyinstaller 버전을 제한한 사유는 무엇인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyinstaller에서 에러가 발생하며 위 메시지가 발생하여 구문을 고치고 버전을 제한하게 됐습니다.
생각을 해보니 위 에러는
unix
/window
환경 차이의 문제 같기도 합니다..! (조금 더 찾아봐야 할 것 같습니다)