@@ -28,14 +28,16 @@ if(PAL_TRAIT_PYTHONCOVERAGE_SUPPORTED)
|
||||
PUBLIC
|
||||
PYTHON_COVERAGE_EDITOR
|
||||
PRIVATE
|
||||
LY_TEST_IMPACT_DEFAULT_CONFIG_FILE=\"\"
|
||||
${LY_TEST_IMPACT_CONFIG_FILE_PATH_DEFINITION}
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzToolsFramework
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::EditorPythonBindings.Editor
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME PythonCoverage.Editor MODULE
|
||||
NAME PythonCoverage.Editor GEM_MODULE
|
||||
NAMESPACE Gem
|
||||
AUTOMOC
|
||||
OUTPUT_NAME Gem.PythonCoverage.Editor
|
||||
@@ -58,26 +60,3 @@ if(PAL_TRAIT_PYTHONCOVERAGE_SUPPORTED)
|
||||
ly_create_alias(NAME PythonCoverage.Builders NAMESPACE Gem TARGETS Gem::PythonCoverage.Editor)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
ly_add_target(
|
||||
NAME PythonCoverage.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
pythoncoverage_editor_tests_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Tests
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzTest
|
||||
Gem::PythonCoverage.Editor
|
||||
)
|
||||
|
||||
ly_add_googletest(
|
||||
NAME Gem::PythonCoverage.Editor.Tests
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
+6
-8
@@ -76,20 +76,18 @@ namespace PythonCoverage
|
||||
void PythonCoverageEditorSystemComponent::ParseCoverageOutputDirectory()
|
||||
{
|
||||
m_coverageState = CoverageState::Disabled;
|
||||
|
||||
// Config file path will be empty if test impact analysis framework is disabled at the build config level
|
||||
const AZStd::string configFilePath = LY_TEST_IMPACT_DEFAULT_CONFIG_FILE;
|
||||
|
||||
if (configFilePath.empty())
|
||||
{
|
||||
AZ_Warning(Caller, false, "No test impact analysis framework config found.");
|
||||
AZ_Warning(Caller, false, "No test impact analysis framework config file specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto fileSize = AZ::IO::SystemFile::Length(configFilePath.c_str());
|
||||
if(!fileSize)
|
||||
{
|
||||
AZ_Error(Caller, false, "File '%s' does not exist", configFilePath.c_str());
|
||||
AZ_Error(Caller, false, "Test impact analysis framework config file '%s' does not exist", configFilePath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +95,7 @@ namespace PythonCoverage
|
||||
buffer[fileSize] = '\0';
|
||||
if (!AZ::IO::SystemFile::Read(configFilePath.c_str(), buffer.data()))
|
||||
{
|
||||
AZ_Error(Caller, false, "Could not read contents of file '%s'", configFilePath.c_str());
|
||||
AZ_Error(Caller, false, "Could not read contents of test impact analysis framework config file '%s'", configFilePath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,13 +103,13 @@ namespace PythonCoverage
|
||||
rapidjson::Document configurationFile;
|
||||
if (configurationFile.Parse(configurationData.c_str()).HasParseError())
|
||||
{
|
||||
AZ_Error(Caller, false, "Could not parse runtimeConfig data, JSON has errors");
|
||||
AZ_Error(Caller, false, "Could not parse test impact analysis framework config file data, JSON has errors");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& tempConfig = configurationFile["workspace"]["temp"];
|
||||
|
||||
// Temo directory root path is absolute
|
||||
// Temp directory root path is absolute
|
||||
const AZ::IO::Path tempWorkspaceRootDir = tempConfig["root"].GetString();
|
||||
|
||||
// Artifact directory is relative to temp directory root
|
||||
@@ -212,7 +210,7 @@ namespace PythonCoverage
|
||||
return coveringModuleOutputNames;
|
||||
}
|
||||
|
||||
void PythonCoverageEditorSystemComponent::OnExecuteByFilenameAsTest(AZStd::string_view filename, AZStd::string_view testCase, [[maybe_unused]] const AZStd::vector<AZStd::string_view>& args)
|
||||
void PythonCoverageEditorSystemComponent::OnStartExecuteByFilenameAsTest(AZStd::string_view filename, AZStd::string_view testCase, [[maybe_unused]] const AZStd::vector<AZStd::string_view>& args)
|
||||
{
|
||||
if (m_coverageState == CoverageState::Disabled)
|
||||
{
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ namespace PythonCoverage
|
||||
void OnEntityActivated(const AZ::EntityId& entityId) override;
|
||||
|
||||
// AZ::EditorPythonScriptNotificationsBus ...
|
||||
void OnExecuteByFilenameAsTest(AZStd::string_view filename, AZStd::string_view testCase, const AZStd::vector<AZStd::string_view>& args) override;
|
||||
void OnStartExecuteByFilenameAsTest(AZStd::string_view filename, AZStd::string_view testCase, const AZStd::vector<AZStd::string_view>& args) override;
|
||||
|
||||
//! Attempts to parse the test impact analysis framework configuration file.
|
||||
//! If either the test impact analysis framework is disabled or the configuration file cannot be parsed, python coverage
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
#include <AzTest/AzTest.h>
|
||||
|
||||
class PythonCoverageEditorTest
|
||||
: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(PythonCoverageEditorTest, SanityTest)
|
||||
{
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
|
||||
@@ -1,14 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
Tests/PythonCoverageEditorTest.cpp
|
||||
)
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"gem_name": "PythonCoverage",
|
||||
"origin": "The primary repo for PythonCoverage goes here: i.e. http://www.mydomain.com",
|
||||
"license": "What license PythonCoverage uses goes here: i.e. https://opensource.org/licenses/MIT",
|
||||
"display_name": "PythonCoverage",
|
||||
"summary": "A short description of PythonCoverage.",
|
||||
"summary": "A tool for generating gem coverage for Python tests.",
|
||||
"canonical_tags": [
|
||||
"Gem"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user