77import subprocess
88
99
10- def run_command (command ): # 리눅스 명령어 실행
11- result = subprocess .run (command , capture_output = True , text = True )
10+ def run_command (* args ): # 리눅스 명령어 실행
11+ result = subprocess .run (args , capture_output = True , text = True )
1212 success = result .returncode == 0
1313 output = result .stdout if success else result .stderr
1414 return success , output
1515
1616
1717def test_test_run_environment (): # 테스트 환경 tox.ini
1818 # Given
19- run_command ("rm -rf test_result" )
19+ run_command ("rm" , " -rf" , " test_result" )
2020 os .makedirs ("test_result" , exist_ok = True )
2121
2222 # When
23- csv_success , _ = run_command ("fosslight_bin -p . -o test_result -f csv" )
24- exclude_success , _ = run_command ("fosslight_bin -p . -e test commons-logging-1.2.jar -o test_result/exclude_result.csv -f csv" )
25- files_in_result = run_command ("ls test_result/ " )[1 ].split ()
26- txt_success , txt_output = run_command ("bash -c ' find test_result -type f -name \ " fosslight_log*.txt\" ' " )
23+ csv_success , _ = run_command ("fosslight_bin" , "-p" , "." , "-o" , " test_result" , "-f" , " csv" )
24+ exclude_success , _ = run_command ("fosslight_bin" , "-p" , "." , "-e" , " test" , " commons-logging-1.2.jar" , "-o" , " test_result/exclude_result.csv" , "-f" , " csv" )
25+ files_in_result = run_command ("ls" , " test_result" )[1 ].split ()
26+ txt_success , txt_output = run_command ("find" , " test_result" , " -type" , "f" , " -name" , "fosslight_log*.txt" )
2727
2828 # Then
2929 csv_files = [f for f in files_in_result if f .endswith ('.csv' )]
@@ -36,15 +36,15 @@ def test_test_run_environment(): # 테스트 환경 tox.ini
3636
3737def test_release_environment (): # 릴리즈 환경 tox.ini
3838 # Given
39- run_command ("rm -rf test_result" )
39+ run_command ("rm" , " -rf" , " test_result" )
4040 os .makedirs ("test_result" , exist_ok = True )
4141
4242 # When
43- help_success , _ = run_command ("fosslight_bin -h" )
44- csv_success , _ = run_command ("fosslight_bin -p . -o test_result/result.csv -f csv" )
45- exclude_csv_success , _ = run_command ("fosslight_bin -p . -e test commons-logging-1.2.jar -o test_result/exclude_result.csv -f csv" )
46- json_success , _ = run_command ("fosslight_bin -p . -o test_result/result.json -f opossum" )
47- files_in_result = run_command ("ls test_result/ " )[1 ].split ()
43+ help_success , _ = run_command ("fosslight_bin" , " -h" )
44+ csv_success , _ = run_command ("fosslight_bin" , "-p" , "." , "-o" , " test_result/result.csv" , "-f" , " csv" )
45+ exclude_csv_success , _ = run_command ("fosslight_bin" , "-p" , "." , "-e" , " test" , " commons-logging-1.2.jar" , "-o" , " test_result/exclude_result.csv" , "-f" , " csv" )
46+ json_success , _ = run_command ("fosslight_bin" , "-p" , "." , "-o" , " test_result/result.json" , "-f" , " opossum" )
47+ files_in_result = run_command ("ls" , " test_result" )[1 ].split ()
4848
4949 # Then
5050 required_files = ['result.csv' , 'exclude_result.csv' , 'result.json' ]
0 commit comments