Skip to content

Commit

Permalink
fix: lint error
Browse files Browse the repository at this point in the history
Signed-off-by: cjho0316 <[email protected]>
  • Loading branch information
cjho0316 committed Oct 6, 2024
1 parent 8272bcb commit 6e77924
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def test_set_args(monkeypatch):
# Mocking os.path.isfile to return True
monkeypatch.setattr("os.path.isfile", lambda x: True)

# Mocking the open function to return a mock file object
mock_file_data = json.dumps({
"mode": ["test_mode"],
Expand All @@ -35,25 +35,25 @@ def test_set_args(monkeypatch):
"source_time_out": 100,
"binary_simple": True
})

def mock_open(*args, **kwargs):
from io import StringIO
return StringIO(mock_file_data)

monkeypatch.setattr("builtins.open", mock_open)

# Call the function with some arguments
result = set_args(
mode=None, path=None, dep_argument=None, output=None, format=None, link=None, db_url=None, timer=None,
raw=None, core=-1, no_correction=None, correct_fpath=None, ui=None, setting="dummy_path", exclude_path=None
)

# Expected result
expected = (
["test_mode"], ["test_path"], "test_dep_argument", "test_output", "test_format", "test_link", "test_db_url", True,
True, 4, True, "test_correct_fpath", True, ["test_exclude_path"], "test_scanner", True, True, 100, True
)

assert result == expected


Expand Down
3 changes: 1 addition & 2 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import os
import pytest
from fosslight_util.oss_item import OssItem
from fosslight_scanner.common import copy_file, run_analysis, call_analysis_api, check_exclude_dir


Expand Down Expand Up @@ -113,4 +112,4 @@ def test_correct_scanner_result():
("project/venv/file.py", True, True),
])
def test_check_exclude_dir(source_name_or_path, file_item_exclude, expected):
assert check_exclude_dir(source_name_or_path, file_item_exclude) == expected
assert check_exclude_dir(source_name_or_path, file_item_exclude) == expected

0 comments on commit 6e77924

Please sign in to comment.