Skip to content

Add python tests model classes #9

Add python tests model classes

Add python tests model classes #9

Triggered via pull request November 8, 2023 21:12
@mikaelhmmikaelhm
reopened #19
Status Success
Total duration 21s
Artifacts

spell-check.yml

on: pull_request_target
spellcheck
12s
spellcheck
Fit to window
Zoom out
Zoom in

Annotations

71 errors
app/tests/python_tests/test_python_parser.py#L19
Module "test_collections.sdk_tests.support.python_testing.models.python_test_parser" has no attribute "PythonParserException" [attr-defined]
app/tests/python_tests/test_python_parser.py#L19
Module "test_collections.sdk_tests.support.python_testing.models.python_test_parser" has no attribute "parse_python_test" [attr-defined]
test_collections/sdk_tests/support/yaml_tests/sdk_yaml_tests.py#L138
Argument "yaml_version" to "_parse_all_yaml" has incompatible type "None"; expected "str" [arg-type]
test_collections/sdk_tests/support/yaml_tests/sdk_yaml_tests.py#L147
Incompatible return value type (got "None", expected "YamlCollectionDeclaration") [return-value]
test_collections/sdk_tests/support/python_testing/sdk_python_test_tests.py#L21
Module "test_collections.sdk_tests.support.python_testing.models.python_test_parser" has no attribute "PythonParserException" [attr-defined]
test_collections/sdk_tests/support/python_testing/sdk_python_test_tests.py#L21
Module "test_collections.sdk_tests.support.python_testing.models.python_test_parser" has no attribute "parse_python_test" [attr-defined]
app/test_engine/models/manual_test_case.py#L159
Line too long (124 > 88 characters) (E501)
app/tests/python_tests/test_python_folder.py#L19
Line too long (89 > 88 characters) (E501)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/test_engine/models/manual_test_case.py#L154
with file.file as f: for line in f: try: logger.info(line.decode("utf-8").strip()) except UnicodeDecodeError: - logger.warning("WARNING: The following line contained invalid UTF-8. Some content was replaced with: �") - logger.info(line.decode("utf-8", errors='replace').strip()) + logger.warning( + "WARNING: The following line contained invalid UTF-8. Some content was replaced with: �" + ) + logger.info(line.decode("utf-8", errors="replace").strip()) logger.info("---- End of Manual Log ----") class ManualTestCase(TestCase, UserPromptSupport): """Test case used to generate all manual test cases.
app/tests/python_tests/test_python_folder.py#L32
Line too long (91 > 88 characters) (E501)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_folder.py#L52
_ = python_folder.python_file_paths() path_glob.assert_called_once_with("*.py") path_glob.reset_mock() pattern = "TC_*" - python_test_folder = PythonTestFolder(test_python_path, filename_pattern=pattern) + python_test_folder = PythonTestFolder( + test_python_path, filename_pattern=pattern + ) _ = python_test_folder.python_file_paths() path_glob.assert_called_once_with(f"{pattern}.py")
app/tests/python_tests/test_python_folder.py#L57
Line too long (89 > 88 characters) (E501)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_parser.py#L67
new=mock.mock_open(read_data=sample_invalid_python_file_content), ): try: parse_python_test(file_path) except PythonParserException as e: - assert "Test Case file does not have methods desc_file or steps_file" == str(e) + assert ( + "Test Case file does not have methods desc_file or steps_file" == str(e) + ) def test_python_file_parser() -> None: file_path = Path("/test/file.py")
app/tests/python_tests/test_python_parser.py#L19
Line too long (89 > 88 characters) (E501)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L1
- - # - # Copyright (c) 2023 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. +# +# Copyright (c) 2023 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. # Copyright (c) 2021 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
app/tests/python_tests/test_python_parser.py#L66
Line too long (91 > 88 characters) (E501)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L31
""" This is just a sample test case that should come from SDK. It should not compile or run. """ + + class TC_Sample(MatterBaseTest): - def desc_TC_Sample(self) -> str: return "Sample TC Description" def steps_TC_Sample(self) -> list[TestStep]: steps = [
app/tests/python_tests/test_python_parser.py#L72
Line too long (91 > 88 characters) (E501)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L46
] return steps @async_test_body async def test_steps_TC_Sample(self): - print("Test execution") + print("Test execution")
app/tests/python_tests/test_python_parser.py#L81
Line too long (91 > 88 characters) (E501)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_test_declarations.py#L17
from test_collections.sdk_tests.support.python_testing.models.test_declarations import ( PythonCaseDeclaration, PythonSuiteDeclaration, ) -from test_collections.sdk_tests.support.python_testing.models.test_suite import SuiteType +from test_collections.sdk_tests.support.python_testing.models.test_suite import ( + SuiteType, +) from test_collections.sdk_tests.support.python_testing.models.python_test_models import ( PythonTest, )
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_test_suite.py#L46
def test_python_test_suite_python_version() -> None: """Test that test suite python version is set correctly in class factory.""" python_test_version = "best_version" # Create a subclass of PythonTestSuite suite_class: Type[PythonTestSuite] = PythonTestSuite.class_factory( - suite_type=SuiteType.AUTOMATED, name="SomeSuite", python_test_version=python_test_version + suite_type=SuiteType.AUTOMATED, + name="SomeSuite", + python_test_version=python_test_version, ) assert suite_class.python_test_version == python_test_version
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_test_suite.py#L94
"""Test that both PythonTestSuite.setup and ChipToolSuite.setup are called when PythonChipToolsSuite.setup is called. We do this as PythonChipToolsSuite inherits from both PythonTestSuite and ChipToolSuite.""" suite_class: Type[PythonTestSuite] = PythonTestSuite.class_factory( - suite_type=SuiteType.AUTOMATED, name="SomeSuite", python_test_version="Some version" + suite_type=SuiteType.AUTOMATED, + name="SomeSuite", + python_test_version="Some version", ) suite_instance = suite_class(TestSuiteExecution()) with mock.patch(
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L2
Indentation is not a multiple of 4 (comment) (E114)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_test_case.py#L46
path: Optional[Path] = None, ) -> PythonTest: return PythonTest( name=name, PICS=PICS, - config=config, + config=config, steps=steps, type=type, path=path, )
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L2
Unexpected indentation (comment) (E116)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/python_tests/test_python_test_case.py#L243
) instance = case_class(TestCaseExecution()) # Assert all steps from python test are added assert len(instance.test_steps) >= no_steps - steps_from_python = [s for s in instance.test_steps if s.name == test_step.label] + steps_from_python = [ + s for s in instance.test_steps if s.name == test_step.label + ] assert len(steps_from_python) == no_steps @pytest.mark.asyncio async def test_setup_super_error_handling() -> None:
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L3
Indentation is not a multiple of 4 (comment) (E114)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/yaml_tests/test_yaml_folder.py#L29
# We mock open to read version_file_content and Path exists to ignore that we're # testing with a fake path with mock.patch( "test_collections.sdk_tests.support.yaml_tests.models.yaml_test_folder.open", new=mock.mock_open(read_data=version_file_content), - ), mock.patch.object( - target=Path, attribute="exists", return_value=True - ) as _: + ), mock.patch.object(target=Path, attribute="exists", return_value=True) as _: yaml_folder = YamlTestFolder(test_yaml_path) assert yaml_folder.version == version_file_content def test_yaml_folder_version_missing() -> None: expected_version = "Unknown" - with mock.patch.object( - target=Path, attribute="exists", return_value=False - ) as _: + with mock.patch.object(target=Path, attribute="exists", return_value=False) as _: yaml_folder = YamlTestFolder(test_yaml_path) assert yaml_folder.version == expected_version def test_yaml_folder_filename_pattern() -> None:
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L3
Unexpected indentation (comment) (E116)
/home/runner/work/certification-tool-backend/certification-tool-backend/app/tests/yaml_tests/test_sdk_yaml_collection.py#L31
sdk_yaml_test_collection, ) VERSION_FILE_FILENAME = ".version" VERSION_FILE_PATH = Path("/app/backend/test_collections/sdk_tests/sdk_checkout/") + @pytest.fixture def yaml_collection() -> YamlCollectionDeclaration: test_sdk_yaml_path = Path(__file__).parent / "test_yamls" folder = YamlTestFolder(path=test_sdk_yaml_path, filename_pattern="UnitTest_TC_*")
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L4
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L4
Unexpected indentation (comment) (E116)
/home/runner/work/certification-tool-backend/certification-tool-backend/test_collections/sdk_tests/__init__.py#L12
# 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. # from .support.yaml_tests import sdk_collection, custom_collection + # TODO The Python test support implementation is ongoing. -# Uncomment line below when the implementation is done. -#from .support.python_testing import sdk_python_collection +# Uncomment line below when the implementation is done. +# from .support.python_testing import sdk_python_collection
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L5
Indentation is not a multiple of 4 (comment) (E114)
/home/runner/work/certification-tool-backend/certification-tool-backend/test_collections/sdk_tests/support/yaml_tests/__init__.py#L19
# Test engine will auto load TestCollectionDeclarations declared inside the package # initializer sdk_collection: TestCollectionDeclaration = sdk_yaml_test_collection() -custom_collection: TestCollectionDeclaration = custom_yaml_test_collection() +custom_collection: TestCollectionDeclaration = custom_yaml_test_collection()
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L5
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L6
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L6
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L7
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L7
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L8
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L8
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L9
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L9
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L10
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L10
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L11
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L11
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L12
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L12
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L13
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L13
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L14
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L14
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L15
Indentation is not a multiple of 4 (comment) (E114)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L15
Unexpected indentation (comment) (E116)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L36
Expected 2 blank lines, found 0 (E302)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L36
Undefined name 'MatterBaseTest' (F821)
app/tests/python_tests/test_python_script/UnitTest_TC_ACL_1_1_Automated.py#L49
Undefined name 'async_test_body' (F821)
app/tests/python_tests/test_python_test_case.py#L30
Line too long (89 > 88 characters) (E501)
app/tests/python_tests/test_python_test_case.py#L51
Trailing whitespace (W291)
app/tests/python_tests/test_python_test_case.py#L82
Line too long (91 > 88 characters) (E501)
app/tests/python_tests/test_python_test_case.py#L105
Line too long (89 > 88 characters) (E501)