[ 
https://issues.apache.org/jira/browse/AMBARI-26524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17987348#comment-17987348
 ] 

Gandhe harshith commented on AMBARI-26524:
------------------------------------------

Tests with python3.11
{code:java}
mvn clean -am test -pl ambari-server -DskipSurefireTests 
-Dmaven.test.failure.ignore -Dmaven.artifact.threads=10 -Drat.skip 
-Dcheckstyle.skip -DskipAdminWebTests=true
.
.
test_update_properties_2 
(TestAmbariServer.TestAmbariServer.test_update_properties_2) ... ok
test_upgrade_from_161 (TestAmbariServer.TestAmbariServer.test_upgrade_from_161) 
... ok
test_validate_jdk (TestAmbariServer.TestAmbariServer.test_validate_jdk) ... ok
test_web_server_startup_timeout 
(TestAmbariServer.TestAmbariServer.test_web_server_startup_timeout) ... 
ok======================================================================
ERROR: test_start (TestAmbariServer.TestAmbariServer.test_start)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 1195, in patched
    arg = patching.__enter__()
          ^^^^^^^^^^^^^^^^^^^^
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 1343, in __enter__
    new = create_autospec(autospec, spec_set=spec_set, _name=self.attribute, 
**kwargs)
          
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 2205, in create_autospec
    _check_signature(spec, mock, is_type, instance)
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 225, in _check_signature
    result = _getsignature(func, skipfirst, instance)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 204, in _getsignature
    signature = inspect.formatargspec(
                ^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 
'formatargspec'----------------------------------------------------------------------
Ran 296 tests in 10.919sFAILED (errors=1)
----------------------------------------------------------------------
Failed tests:
ERROR: test_start (TestAmbariServer.TestAmbariServer.test_start)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 1195, in patched
    arg = patching.__enter__()
          ^^^^^^^^^^^^^^^^^^^^
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 1343, in __enter__
    new = create_autospec(autospec, spec_set=spec_set, _name=self.attribute, 
**kwargs)
          
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 2205, in create_autospec
    _check_signature(spec, mock, is_type, instance)
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 225, in _check_signature
    result = _getsignature(func, skipfirst, instance)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/apache_repos/ambari/ambari-common/src/test/python/mock/mock.py", 
line 204, in _getsignature
    signature = inspect.formatargspec(
                ^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 
'formatargspec'----------------------------------------------------------------------
Total run:352
Total errors:1
Total failures:0
ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Ambari Main 3.1.0.0-SNAPSHOT:
[INFO]
[INFO] Ambari Main ........................................ SUCCESS [  2.026 s]
[INFO] Apache Ambari Project POM .......................... SUCCESS [  0.034 s]
[INFO] Ambari Views ....................................... SUCCESS [  1.146 s]
[INFO] Ambari Admin View .................................. SUCCESS [  7.281 s]
[INFO] ambari-utility ..................................... SUCCESS [  1.096 s]
[INFO] Ambari Server SPI .................................. SUCCESS [  0.283 s]
[INFO] Ambari Service Advisor ............................. SUCCESS [  0.110 s]
[INFO] Ambari Server ...................................... FAILURE [ 49.912 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:04 min
[INFO] Finished at: 2025-07-02T11:06:36+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 
(python-test) on project ambari-server: Command execution failed.: Process 
exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :ambari-server {code}
With changes
{code:java}
mvn clean -am test -pl ambari-server -DskipSurefireTests 
-Dmaven.test.failure.ignore -Dmaven.artifact.threads=10 -Drat.skip 
-Dcheckstyle.skip -DskipAdminWebTests=true
.
.
test_start (TestAmbariServer.TestAmbariServer.test_start) ... ok
.
.
test_get_ubuntu_pg_version (TestUtils.TestUtils.test_get_ubuntu_pg_version) ... 
ok
test_locate_file (TestUtils.TestUtils.test_locate_file) ... ok
test_looking_for_pid (TestUtils.TestUtils.test_looking_for_pid) ... ok
test_pid_exists (TestUtils.TestUtils.test_pid_exists) ... ok
test_save_main_pid_ex (TestUtils.TestUtils.test_save_main_pid_ex) ... ok
test_check_directories 
(TestValidateConfigs.TestValidateConfigs.test_check_directories) ... Error: 
Validation failed. Directory / already exists and isn't empty!
ok
test_check_user_in_group 
(TestValidateConfigs.TestValidateConfigs.test_check_user_in_group) ... ok
test_check_users (TestValidateConfigs.TestValidateConfigs.test_check_users) ... 
Error: Validation failed. root is not a member of wrong_group group and root 
account can't be created!
Error: Validation failed. wrong_user is not a member of root group and 
wrong_user account can't be created!
Error: Validation failed. wrong_user is not a member of wrong_group group and 
wrong_user account can't be created!
ok
test_flatten_dict (TestValidateConfigs.TestValidateConfigs.test_flatten_dict) 
... ok
test_get_value (TestValidateConfigs.TestValidateConfigs.test_get_value) ... ok
test_comparison (TestVersion.TestVersion.test_comparison) ... ok
test_format (TestVersion.TestVersion.test_format) ... ok
test_format_with_hyphens (TestVersion.TestVersion.test_format_with_hyphens) ... 
ok
test_get_current_component_version 
(TestVersion.TestVersion.test_get_current_component_version) ... ok
test_mpack_version (TestVersion.TestVersion.test_mpack_version) ... ok
test_get_component_version_from_symlink 
(TestVersionSelectUtil.TestVersionSelectUtil.test_get_component_version_from_symlink)
 ... ok
test_get_component_version_no_build_ids 
(TestVersionSelectUtil.TestVersionSelectUtil.test_get_component_version_no_build_ids)
 ... ok
test_convert_yaml_array (TestYAMLUtils.TestYAMLUtils.test_convert_yaml_array) 
... ok
test_yaml_property_escaping 
(TestYAMLUtils.TestYAMLUtils.test_yaml_property_escaping)
Tests that YAML values are escaped with quotes properly when needed ... 
ok----------------------------------------------------------------------
Ran 296 tests in 16.319sOK
----------------------------------------------------------------------
Total run:352
Total errors:0
Total failures:0
OK
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (checkstyle) @ ambari-server ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Ambari Main 3.1.0.0-SNAPSHOT:
[INFO]
[INFO] Ambari Main ........................................ SUCCESS [  1.710 s]
[INFO] Apache Ambari Project POM .......................... SUCCESS [  0.032 s]
[INFO] Ambari Views ....................................... SUCCESS [  1.127 s]
[INFO] Ambari Admin View .................................. SUCCESS [  6.935 s]
[INFO] ambari-utility ..................................... SUCCESS [  1.089 s]
[INFO] Ambari Server SPI .................................. SUCCESS [  0.275 s]
[INFO] Ambari Service Advisor ............................. SUCCESS [  0.105 s]
[INFO] Ambari Server ...................................... SUCCESS [ 42.960 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  54.489 s
[INFO] Finished at: 2025-07-02T12:42:22+05:30
[INFO] 
------------------------------------------------------------------------{code}

> Fix "inspect" deprecations for Python 3.11 compatibility
> --------------------------------------------------------
>
>                 Key: AMBARI-26524
>                 URL: https://issues.apache.org/jira/browse/AMBARI-26524
>             Project: Ambari
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Gandhe harshith
>            Priority: Major
>             Fix For: 3.1.0
>
>
> from [https://docs.python.org/3/whatsnew/3.11.html] 
> Removed from the 
> [{{inspect}}|https://docs.python.org/3/library/inspect.html#module-inspect] 
> module:
>  * The {{getargspec()}} function, deprecated since Python 3.0; use 
> [{{inspect.signature()}}|https://docs.python.org/3/library/inspect.html#inspect.signature]
>  or 
> [{{inspect.getfullargspec()}}|https://docs.python.org/3/library/inspect.html#inspect.getfullargspec]
>  instead.
>  * The {{formatargspec()}} function, deprecated since Python 3.5; use the 
> [{{inspect.signature()}}|https://docs.python.org/3/library/inspect.html#inspect.signature]
>  function or the 
> [{{inspect.Signature}}|https://docs.python.org/3/library/inspect.html#inspect.Signature]
>  object directly.
> Apply required changes to support python3.11
> ----
> in python3.10
>  
> {code:java}
> Python 3.10.18 (main, Jun 12 2025, 02:22:13) [GCC 12.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import inspect
> >>> inspect.formatargspec
> <function formatargspec at 0xffff85a50dc0>
> >>>
> >>> inspect.getargspec
> <function getargspec at 0xffff85a500d0> 
> >>>
> >>> inspect.getfullargspec
> <function getfullargspec at 0xffff85a505e0>
> >>>
> >>> inspect.signature
> <function signature at 0xffff85a52dd0>
> >>>{code}
> and in python3.11
>  
>  
> {code:java}
> Python 3.11.13 (main, Jun 12 2025, 02:01:52) [GCC 12.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> >>> import inspect
> >>> inspect.formatargspec
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: module 'inspect' has no attribute 'formatargspec'. Did you 
> mean: 'formatargvalues'?
> >>>
> >>> inspect.getargspec
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 
> 'getargs'?
> >>> 
> >>> inspect.getfullargspec
> <function getfullargspec at 0xffff82280d60>
> >>>
> >>> inspect.signature
> <function signature at 0xffff82283a60>{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to