diff --git a/tests/integration/template_directions.md b/tests/integration/template_directions.md index 5e4f2fb6..939bca71 100644 --- a/tests/integration/template_directions.md +++ b/tests/integration/template_directions.md @@ -53,7 +53,7 @@ cd #expand expected_dir#expected_bundles find . -type f -name '*.png' > ../image_list_expected_bundles.txt cd # Rerun test -python -u -m unittest tests/integration/test_bundles_#expand machine#.py +python -u -m unittest tests/integration/test_bundles.py ``` ### test_campaign @@ -83,7 +83,7 @@ cd #expand expected_dir#expected_complete_run find . -type f -name '*.png' > ../image_list_expected_complete_run.txt cd # Rerun test -python -u -m unittest tests/integration/test_complete_run_#expand machine#.py +python -u -m unittest tests/integration/test_complete_run.py ``` ### test_defaults diff --git a/tests/integration/test_bundles.py b/tests/integration/test_bundles.py index 8b3c8b1b..fb44315a 100644 --- a/tests/integration/test_bundles.py +++ b/tests/integration/test_bundles.py @@ -91,7 +91,7 @@ def test_bundles_images(self): expected_images_dir = f"{expected_dir}expected_bundles" # The directory to place differences in. - diff_dir = "tests/integration/image_check_failures_bundles" + diff_dir = f"{actual_images_dir}image_check_failures_bundles" check_mismatched_images( self, actual_images_dir, expected_images_file, expected_images_dir, diff_dir diff --git a/tests/integration/test_complete_run.py b/tests/integration/test_complete_run.py index 280bc65e..866683f8 100644 --- a/tests/integration/test_complete_run.py +++ b/tests/integration/test_complete_run.py @@ -10,7 +10,7 @@ def test_complete_run(self): expected_dir = expansions["expected_dir"] user_www = expansions["user_www"] actual_images_dir = ( - f"{user_www}zppy_test_complete_run_www/v2.LR.historical_0201" + f"{user_www}zppy_test_complete_run_www/v2.LR.historical_0201/" ) # The expected_images_file lists all images we expect to compare. @@ -18,7 +18,7 @@ def test_complete_run(self): expected_images_dir = f"{expected_dir}expected_complete_run" # The directory to place differences in. - diff_dir = "tests/integration/image_check_failures_complete_run" + diff_dir = f"{actual_images_dir}image_check_failures_complete_run" check_mismatched_images( self, actual_images_dir, expected_images_file, expected_images_dir, diff_dir diff --git a/tests/integration/utils.py b/tests/integration/utils.py index 58c09271..f38d1d04 100644 --- a/tests/integration/utils.py +++ b/tests/integration/utils.py @@ -47,16 +47,17 @@ def compare_images( .getdata() ) num_nonzero_pixels = sum(nonzero_pixels) - print("\npath_to_actual_png={}".format(path_to_actual_png)) - print("path_to_expected_png={}".format(path_to_expected_png)) - print("diff has {} nonzero pixels.".format(num_nonzero_pixels)) width, height = expected_png.size num_pixels = width * height - print("total number of pixels={}".format(num_pixels)) fraction = num_nonzero_pixels / num_pixels - print("num_nonzero_pixels/num_pixels fraction={}".format(fraction)) # Fraction of mismatched pixels should be less than 0.02% if fraction >= 0.0002: + print("\npath_to_actual_png={}".format(path_to_actual_png)) + print("path_to_expected_png={}".format(path_to_expected_png)) + print("diff has {} nonzero pixels.".format(num_nonzero_pixels)) + print("total number of pixels={}".format(num_pixels)) + print("num_nonzero_pixels/num_pixels fraction={}".format(fraction)) + mismatched_images.append(image_name) simple_image_name = image_name.split("/")[-1].split(".")[0] @@ -113,6 +114,9 @@ def check_mismatched_images( for i in mismatched_images: print(i) + # Make diff_dir readable + os.system(f"chmod -R 755 {diff_dir}") + test.assertEqual(missing_images, []) test.assertEqual(mismatched_images, [])