From a578b835d0d21adca4409addac6574ee05f0629e Mon Sep 17 00:00:00 2001 From: shashi gharti Date: Thu, 9 Jun 2022 20:06:31 +0545 Subject: [PATCH] fixes for failing tests --- tests/report/test_report.py | 11 ++++++++--- tests/report/test_reporttask.py | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/report/test_report.py b/tests/report/test_report.py index 49747fd758..1d8ead2100 100644 --- a/tests/report/test_report.py +++ b/tests/report/test_report.py @@ -1,4 +1,7 @@ -from frictionless import validate +from frictionless import validate, helpers + + +IS_UNIX = not helpers.is_platform("windows") def test_program_error_not_found(): @@ -30,11 +33,12 @@ def test_report_summary_validate_summary_valid(): report = validate("data/capital-valid.csv") output = report.to_summary() print(output) + file_size = 50 if IS_UNIX else 56 assert ( output.count("valid") and output.count("Summary") and output.count("File name | data/capital-valid.csv") - and output.count("File size (bytes) | 50 ") + and output.count(f"File size (bytes) | {file_size} ") and output.count("Total Time Taken (sec) | ") ) @@ -43,11 +47,12 @@ def test_report_summary_validate_summary_invalid(): report = validate("data/capital-invalid.csv") output = report.to_summary() print(output) + file_size = 171 if IS_UNIX else 183 assert ( output.count("invalid") and output.count("Summary") and output.count("File name | data/capital-invalid.csv") - and output.count("File size (bytes) | 171 ") + and output.count(f"File size (bytes) | {file_size} ") and output.count("Total Time Taken (sec) |") and output.count("Total Errors | 5 ") and output.count("Duplicate Label (duplicate-label) | 1 ") diff --git a/tests/report/test_reporttask.py b/tests/report/test_reporttask.py index 33458154bc..b268253b41 100644 --- a/tests/report/test_reporttask.py +++ b/tests/report/test_reporttask.py @@ -1,13 +1,17 @@ -from frictionless import validate +from frictionless import validate, helpers + + +IS_UNIX = not helpers.is_platform("windows") def test_report_reporttask_summary_valid(): report = validate("data/capital-valid.csv") output = report.tasks[0].to_summary() print(output) + file_size = 50 if IS_UNIX else 56 assert ( output.count("File name | data/capital-valid.csv") - and output.count("File size (bytes) | 50 ") + and output.count(f"File size (bytes) | {file_size} ") and output.count("Total Time Taken (sec) | ") ) @@ -16,9 +20,10 @@ def test_report_reporttask_summary_invalid(): report = validate("data/capital-invalid.csv") output = report.tasks[0].to_summary() print(output) + file_size = 171 if IS_UNIX else 183 assert ( output.count("File name | data/capital-invalid.csv") - and output.count("File size (bytes) | 171 ") + and output.count(f"File size (bytes) | {file_size} ") and output.count("Total Time Taken (sec) |") and output.count("Total Errors | 5 ") and output.count("Duplicate Label (duplicate-label) | 1 ")