test: 🧪 Update a flaky test due to different console width in diff envs

This commit is contained in:
Ricardo Montañana Gómez
2023-01-15 19:32:01 +01:00
parent 149584be3d
commit 520f8807e5
2 changed files with 24 additions and 1 deletions

View File

@@ -111,7 +111,16 @@ class BeReportTest(TestBase):
def test_be_report_without_subcommand(self):
stdout, stderr = self.execute_script("be_report", "")
self.assertEqual(stderr.getvalue(), "")
self.check_output_file(stdout, "report_without_subcommand")
self.maxDiff = None
# Can't use check_output_file because of the width of the console
# output is different in different environments
file_name = "report_without_subcommand" + self.ext
with open(os.path.join(self.test_files, file_name)) as f:
expected = f.read()
if expected == stdout.getvalue():
self.assertEqual(stdout.getvalue(), expected)
else:
self.check_output_file(stdout, "report_without_subcommand2")
def test_be_report_excel_compared(self):
file_name = "results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json"

View File

@@ -0,0 +1,14 @@
usage: be_report [-h] {best,grid,file,datasets} ...
positional arguments:
{best,grid,file,datasets}
help for subcommand
best Report best results obtained by any model/score. See
be_build_best
grid Report grid results obtained by any model/score. See
be_build_grid
file Report file results
datasets Report datasets information
options:
-h, --help show this help message and exit