From 68b4c99faf694ff4805a829e59275d12aa53d8df Mon Sep 17 00:00:00 2001 From: Ramon Montoya Vozmediano <1171039+rmv@users.noreply.github.com> Date: Mon, 12 Feb 2024 11:47:53 -0800 Subject: [PATCH 1/3] fix: set optionVar value to default before running tests, small additional fixes Signed-off-by: Ramon Montoya Vozmediano <1171039+rmv@users.noreply.github.com> --- .../job_bundle_output_test_runner.py | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/deadline/maya_submitter/job_bundle_output_test_runner.py b/src/deadline/maya_submitter/job_bundle_output_test_runner.py index 0c74742..56e88f8 100644 --- a/src/deadline/maya_submitter/job_bundle_output_test_runner.py +++ b/src/deadline/maya_submitter/job_bundle_output_test_runner.py @@ -112,6 +112,7 @@ def run_maya_render_submitter_job_bundle_output_test(): mainwin = _get_dcc_main_window() count_succeeded = 0 count_failed = 0 + test_job_bundle_results_file = "" with gui_error_handler("Error running job bundle output test", mainwin): default_tests_dir = Path(__file__).parent.parent.parent.parent / "job_bundle_output_tests" @@ -151,20 +152,24 @@ def run_maya_render_submitter_job_bundle_output_test(): report_fh.write("\n") if count_failed: report_fh.write(f"Failed {count_failed} tests, succeeded {count_succeeded}.\n") - QMessageBox.warning( - mainwin, - "Some Job Bundle Tests Failed", - f"Failed {count_failed} tests, succeeded {count_succeeded}.\nSee the file {test_job_bundle_results_file} for a full report.", - ) else: report_fh.write(f"All tests passed, ran {count_succeeded} total.\n") - QMessageBox.information( - mainwin, - "All Job Bundle Tests Passed", - f"Ran {count_succeeded} tests in total.", - ) report_fh.write(f"Timestamp: {_timestamp_string()}\n") + # Repeat title info in body since macos does not show the window title + if count_failed: + QMessageBox.warning( + mainwin, + "Some Job Bundle Tests Failed", + f"Job Bundle Tests: Failed {count_failed}, succeeded {count_succeeded}.\nSee the file {test_job_bundle_results_file} for a full report.", + ) + else: + QMessageBox.information( + mainwin, + "All Job Bundle Tests Passed", + f"Job Bundle Tests: All {count_succeeded} tests passed.", + ) + def _run_job_bundle_output_test(test_dir: str, dcc_scene_file: str, report_fh, mainwin: Any): with tempfile.TemporaryDirectory(prefix="job_bundle_output_test") as tempdir: @@ -177,6 +182,10 @@ def _run_job_bundle_output_test(test_dir: str, dcc_scene_file: str, report_fh, m # internal paths as necessary. _copy_dcc_scene_file(dcc_scene_file, temp_dcc_scene_file) + # this is saved with global prefs not the scene file, set it to default value + original_optionVar = maya.cmds.optionVar(query="renderSetup_includeAllLights") + maya.cmds.optionVar(intValue=("renderSetup_includeAllLights", 1)) + # Open the DCC scene file _open_dcc_scene_file(temp_dcc_scene_file) QApplication.processEvents() @@ -200,6 +209,9 @@ def _run_job_bundle_output_test(test_dir: str, dcc_scene_file: str, report_fh, m # Close the DCC scene file _close_dcc_scene_file() + # set original optionVar value + maya.cmds.optionVar(intValue=("renderSetup_includeAllLights", original_optionVar)) + # Process every file in the job bundle to replace the temp dir with a standardized path for filename in os.listdir(temp_job_bundle_dir): full_filename = os.path.join(temp_job_bundle_dir, filename) From d482cd6189ddbe886a9fe69473c9624b8d40cf0e Mon Sep 17 00:00:00 2001 From: Ramon Montoya Vozmediano <1171039+rmv@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:21:01 -0800 Subject: [PATCH 2/3] fix: exclude test code from coverage testing Signed-off-by: Ramon Montoya Vozmediano <1171039+rmv@users.noreply.github.com> --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 880d6b1..c79c639 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,7 +117,8 @@ omit = [ "**/__main__.py", "**/_version.py", "*/deadline/maya_submitter/ui/*", - "*/deadline/maya_submitter/shelf.py" + "*/deadline/maya_submitter/shelf.py", + "job_bundle_output_test_runner.py" ] From 3aacd327af89b240c9de3434e18151269f8bd27f Mon Sep 17 00:00:00 2001 From: Ramon Montoya Vozmediano <1171039+rmv@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:31:12 -0700 Subject: [PATCH 3/3] fix: Remove fix added to mainline Signed-off-by: Ramon Montoya Vozmediano <1171039+rmv@users.noreply.github.com> --- .../maya_submitter/job_bundle_output_test_runner.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/deadline/maya_submitter/job_bundle_output_test_runner.py b/src/deadline/maya_submitter/job_bundle_output_test_runner.py index 46869f0..f1dbf94 100644 --- a/src/deadline/maya_submitter/job_bundle_output_test_runner.py +++ b/src/deadline/maya_submitter/job_bundle_output_test_runner.py @@ -213,10 +213,6 @@ def _run_job_bundle_output_test(test_dir: str, dcc_scene_file: str, report_fh, m # internal paths as necessary. _copy_dcc_scene_file(dcc_scene_file, temp_dcc_scene_file) - # this is saved with global prefs not the scene file, set it to default value - original_optionVar = maya.cmds.optionVar(query="renderSetup_includeAllLights") - maya.cmds.optionVar(intValue=("renderSetup_includeAllLights", 1)) - # Open the DCC scene file _open_dcc_scene_file(temp_dcc_scene_file) QApplication.processEvents() @@ -240,9 +236,6 @@ def _run_job_bundle_output_test(test_dir: str, dcc_scene_file: str, report_fh, m # Close the DCC scene file _close_dcc_scene_file() - # set original optionVar value - maya.cmds.optionVar(intValue=("renderSetup_includeAllLights", original_optionVar)) - # Process every file in the job bundle to replace the temp dir with a standardized path for filename in os.listdir(temp_job_bundle_dir): full_filename = os.path.join(temp_job_bundle_dir, filename)