diff --git a/AutomatedTesting/Gem/PythonCoverage/Code/Source/PythonCoverageEditorSystemComponent.cpp b/AutomatedTesting/Gem/PythonCoverage/Code/Source/PythonCoverageEditorSystemComponent.cpp index 1528e09169..ae19cab79e 100644 --- a/AutomatedTesting/Gem/PythonCoverage/Code/Source/PythonCoverageEditorSystemComponent.cpp +++ b/AutomatedTesting/Gem/PythonCoverage/Code/Source/PythonCoverageEditorSystemComponent.cpp @@ -204,7 +204,7 @@ namespace PythonCoverage return coveringModuleOutputNames; } - void PythonCoverageEditorSystemComponent::OnStartExecuteByFilenameAsTest(AZStd::string_view filename, AZStd::string_view testCase, [[maybe_unused]] const AZStd::vector& args) + void PythonCoverageEditorSystemComponent::OnStartExecuteByFilenameAsTest([[maybe_unused]]AZStd::string_view filename, AZStd::string_view testCase, [[maybe_unused]] const AZStd::vector& args) { if (m_coverageState == CoverageState::Disabled) { @@ -226,8 +226,7 @@ namespace PythonCoverage return; } - const AZStd::string scriptName = AZ::IO::Path(filename).Stem().Native(); - const auto coverageFile = m_coverageDir / AZStd::string::format("%s.pycoverage", scriptName.c_str()); + const auto coverageFile = m_coverageDir / AZStd::string::format("%.*s.pycoverage", AZ_STRING_ARG(testCase)); // If this is a different python script we clear the existing entity components and start afresh if (m_coverageFile != coverageFile) diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py index 54bc118f48..510d1b1149 100644 --- a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py +++ b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py @@ -51,7 +51,7 @@ def launch_and_validate_results(request, test_directory, editor, editor_script, logger.debug("Running automated test: {}".format(editor_script)) editor.args.extend(["--skipWelcomeScreenDialog", "--regset=/Amazon/Settings/EnableSourceControl=false", "--regset=/Amazon/Preferences/EnablePrefabSystem=false", run_python, test_case, - f"--pythontestcase={request.node.originalname}", "--runpythonargs", " ".join(cfg_args)]) + f"--pythontestcase={request.node.name}", "--runpythonargs", " ".join(cfg_args)]) if auto_test_mode: editor.args.extend(["--autotest_mode"]) if null_renderer: diff --git a/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py b/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py index f5cd66cbbe..cbb6102a44 100755 --- a/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py +++ b/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py @@ -90,7 +90,7 @@ class TestAutomationBase: editor_starttime = time.time() self.logger.debug("Running automated test") testcase_module_filepath = self._get_testcase_module_filepath(testcase_module) - pycmd = ["--runpythontest", testcase_module_filepath, f"-pythontestcase={request.node.originalname}"] + pycmd = ["--runpythontest", testcase_module_filepath, f"-pythontestcase={request.node.name}"] if use_null_renderer: pycmd += ["-rhi=null"] if batch_mode: diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 4f2e995ac4..027198ac80 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -513,7 +513,7 @@ public: QString m_appRoot; QString m_logFile; QString m_pythonArgs; - QString m_pythontTestCase; + QString m_pythonTestCase; QString m_execFile; QString m_execLineCmd; @@ -562,7 +562,7 @@ public: const std::vector > stringOptions = { {{"logfile", "File name of the log file to write out to.", "logfile"}, m_logFile}, {{"runpythonargs", "Command-line argument string to pass to the python script if --runpython or --runpythontest was used.", "runpythonargs"}, m_pythonArgs}, - {{"pythontestcase", "Test case name of python test script if --runpythontest was used.", "pythontestcase"}, m_pythontTestCase}, + {{"pythontestcase", "Test case name of python test script if --runpythontest was used.", "pythontestcase"}, m_pythonTestCase}, {{"exec", "cfg file to run on startup, used for systems like automation", "exec"}, m_execFile}, {{"rhi", "Command-line argument to force which rhi to use", "dummyString"}, dummyString }, {{"rhi-device-validation", "Command-line argument to configure rhi validation", "dummyString"}, dummyString }, @@ -1535,11 +1535,12 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo) { // Multiple testcases can be specified them with ';', these should match the files to run AZStd::vector testcaseList; + QByteArray pythonTestCase = cmdInfo.m_pythonTestCase.toUtf8(); testcaseList.resize(fileList.size()); { int i = 0; AzFramework::StringFunc::TokenizeVisitor( - fileStr.constData(), + pythonTestCase.constData(), [&i, &testcaseList](AZStd::string_view elem) { testcaseList[i++] = (elem);