Skip to content

Commit

Permalink
Add test for calculate csv output
Browse files Browse the repository at this point in the history
  • Loading branch information
andremralves committed Sep 11, 2024
1 parent 5db2852 commit 6a51fcb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/unit/test_calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,31 @@ def test_calculate_invalid_extracted_file():

shutil.rmtree(config_dirpath)
shutil.rmtree(extract_dirpath)


def test_calculate_csv_output():
config_dirpath = tempfile.mkdtemp()
extract_dirpath = tempfile.mkdtemp()

shutil.copy("tests/unit/data/msgram.json", f"{config_dirpath}/msgram.json")

extracted_file_name = "github_fga-eps-mds-2024.1-MeasureSoftGram-DOC-28-07-2024-00-00-22-extracted.metrics"
shutil.copy(
f"tests/unit/data/{extracted_file_name}",
f"{extract_dirpath}/{extracted_file_name}",
)

args = {
"input_format": "github",
"output_format": "csv",
"config_path": Path(config_dirpath),
"extracted_path": Path(extract_dirpath + f"/{extracted_file_name}"),
}

command_calculate(args)

output_path = Path(f"{config_dirpath}/calc_msgram.csv")
assert output_path.stat().st_size > 0

shutil.rmtree(config_dirpath)
shutil.rmtree(extract_dirpath)

0 comments on commit 6a51fcb

Please sign in to comment.