-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Refactoring of the matter testing infrastructure * Restyled by shfmt * Manually fix restyle * Manually fix restyle * Manually restyle * Manually fix restyle * Manually fix restyle * Renamed testing_support to matter_testing _support * Fixed the support scripts from matter_testing_support * Fixed TC_OVENOPSTATE_2_6.py for import command * replace all os.path.join and such (using _file_) with their own method * Fixed paths.py for import * Fixed imports for TC_DeviceConformace.py * Fixed the broken import for matter_testing * Make sure modules match master * Debug the data model files for spec_parsing * Try to guess data model root * Restyle * Moving Test* from python_testing to matter_testing_support * Removed the tests moved from glob python scripts * Restyled by isort * Added taglist_and_topology_test.py to the support tests list * Restyled by isort * Fixed the structure for accessing example_pics_xml_basic_info.xml * Fixing the TC_RVCCLEANM_2_2.py script according to master changes * Changes according to master * Fixing structuring of TestMatterTestingSupport.py and TestSpecParsingSupport.py * Restyled by isort * Fixed typo on src/python_testing/matter_testing_infrastructure/BUILD.gn tests section * Fixed import for TC_ICDM_3_2.py * Fix Import for TC_RVCCLEANM_2_2.py * Restyled by autopep8 * Update line formatting in TestSpecParsingSupport.py * Fixed comment on execute_python_tests.py * tests.yaml test * Test to fix src/python_testing/test_testing directory imports * Restyled by isort * Fixed code lints * Fix imports for test_testing directory * Fixed imports on test_TC_ICDM_2_1.py * Restyled by autopep8 * Restyled by isort * Updated imported fixes on test_TC_ICDM_2_1.py * Restyled by autopep8 * Restyled by isort * Import fixes for parent directory test imports * Fixing try-except imports for test_testing directory scripts * Remove unwanted import os from 2 scripts * Restyled by isort * Restyled by isort * Restyled by autopep8 * Restyled by isort * Updated paths and spec_xml scripts * Fixed unused imports * Restyled by isort * Try to guess data model root * Fixed wrong string via GUI that was set in vscode * Fix matter_testing imports * Comment * Remove comment * Fixed import and improved logging via flush of stdout * Fixed matter support import for test scripts * Restyled by isort * Fixed "os.environ is not callable, it is a dictionary" Co-authored-by: Andrei Litvin <[email protected]> * Import fixed for TC_CCTRL_2_3.py * Update logic to match master * Fixed multiple executions of the same tests * Fixed test_testing scripts with master * Restyled by isort * Fixing code lints * Restyled by autopep8 * Fix formate changes happened with autosave on TestSpecParsingSupport.py * Fixed module import in MockTestRunner script * Restructured the tasks.py scripts in matter_testing_support * Fixed formatting * Restyled by shfmt * Restyled by isort * Fixed code lints * Fixed imports for the new scripts added * Fixed k1_4 for the test script * Restyled by autopep8 * Fixed import for new scripts added * Added support for v1_4 * Update TestSpecParsingSupport.py * Added the missed part of the code after hard reset from commit d0e3690 * Print statements to test * Update TestSpecParsingSupport.py * Added in_progress for DEFAULT_OUTPUT_DIR_IN_PROGRESS * Added support for conformance_support in atomic attributes * Removing test prints statements * Restyled by isort * Checking in Thermostat's Revision * Check and Verified Cluster Thermostats's Revision * Restyled by isort * Fixed improts with news supports apps.py * Restyled by isort * Fixed imports for ECOINFO scripts * Restyled by isort * Renamed matter_testing_support to chip.testing * Update TestSpecParsingSupport.py * Restyled by shfmt * Restyled by isort * Fixed imports and correct wheel errors * Fixed chip_testing wheel * Update build_python.sh * Fixed the restyler added f-strings breaks * Restyled by autopep8 * Restyled by isort --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Andrei Litvin <[email protected]>
- Loading branch information
Showing
203 changed files
with
474 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2024 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
from enum import Enum | ||
|
||
# Define a branch enum for different versions or branches | ||
|
||
|
||
class Branch(Enum): | ||
MASTER = "master" | ||
V1_3 = "v1_3" | ||
V1_4 = "v1_4" | ||
IN_PROGRESS = "in_progress" | ||
|
||
|
||
def get_chip_root(): | ||
""" | ||
Returns the CHIP root directory, trying the environment variable first | ||
and falling back if necessary. | ||
""" | ||
chip_root = os.getenv('PW_PROJECT_ROOT') | ||
if chip_root: | ||
return chip_root | ||
else: | ||
try: | ||
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) | ||
except Exception as e: | ||
raise EnvironmentError( | ||
"Unable to determine CHIP root directory. Please ensure the environment is activated." | ||
) from e | ||
|
||
|
||
def get_data_model_path(branch: Branch): | ||
""" | ||
Returns the path to the data model directory for a given branch. | ||
""" | ||
chip_root = get_chip_root() | ||
data_model_path = os.path.join(chip_root, 'data_model', branch.value) | ||
if not os.path.exists(data_model_path): | ||
raise FileNotFoundError(f"Data model path for branch {branch} does not exist: {data_model_path}") | ||
return data_model_path | ||
|
||
|
||
def get_spec_xml_output_path(): | ||
""" | ||
Returns the path to the output directory for generated XML files. | ||
""" | ||
chip_root = get_chip_root() | ||
output_dir = os.path.join(chip_root, 'out', 'spec_xml') | ||
if not os.path.exists(output_dir): | ||
os.makedirs(output_dir) # Automatically create the directory if it doesn't exist | ||
return output_dir | ||
|
||
|
||
def get_documentation_file_path(): | ||
""" | ||
Returns the path to the documentation file. | ||
""" | ||
chip_root = get_chip_root() | ||
documentation_file = os.path.join(chip_root, 'docs', 'spec_clusters.md') | ||
if not os.path.exists(documentation_file): | ||
raise FileNotFoundError(f"Documentation file does not exist: {documentation_file}") | ||
return documentation_file | ||
|
||
|
||
def get_python_testing_path(): | ||
""" | ||
Returns the path to the python_testing directory. | ||
""" | ||
chip_root = get_chip_root() | ||
python_testing_path = os.path.join(chip_root, 'src', 'python_testing') | ||
if not os.path.exists(python_testing_path): | ||
raise FileNotFoundError(f"Python testing directory does not exist: {python_testing_path}") | ||
return python_testing_path | ||
|
||
|
||
def get_in_progress_defines(): | ||
""" | ||
Returns a list of defines that are currently in progress. | ||
This can be updated dynamically as needed. | ||
""" | ||
return [ | ||
'aliro', 'atomicwrites', 'battery-storage', 'device-location', 'e2e-jf', | ||
'energy-calendar', 'energy-drlc', 'energy-management', 'heat-pump', 'hrap-1', | ||
'hvac', 'matter-fabric-synchronization', 'metering', 'secondary-net', | ||
'service-area-cluster', 'solar-power', 'tcp', 'water-heater', 'wifiSetup' | ||
] | ||
|
||
|
||
def get_available_branches(): | ||
""" | ||
Return a list of available branches for the data model. | ||
This can be expanded or dynamically fetched if necessary. | ||
""" | ||
return [Branch.MASTER, Branch.V1_3, Branch.V1_4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.