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

Berenguer Blasi commented on CASSANDRA-17293:
---------------------------------------------

Hi [~bschoeni]

SSL is still failing for me. You mean you cannot repro locally? I am on Ubuntu 
20.04, I test with your branch under j8

{noformat}
platform linux -- Python 3.8.10, pytest-7.0.1, pluggy-1.0.0
rootdir: /tmp/cassandra-trunk/pylib
plugins: flaky-3.7.0
collected 87 items                                                              
                                                                                
                                                                                
                                  

test/test_constants.py .                                                        
                                                                                
                                                                                
                            [  1%]
test/test_copyutil.py .                                                         
                                                                                
                                                                                
                            [  2%]
test/test_cql_parsing.py .......................                                
                                                                                
                                                                                
                            [ 28%]
test/test_cqlsh_completion.py ..................                                
                                                                                
                                                                                
                            [ 49%]
test/test_cqlsh_output.py ...................................                   
                                                                                
                                                                                
                            [ 89%]
test/test_sslhandling.py .F.F.                                                  
                                                                                
                                                                                
                            [ 95%]
test/test_unicode.py ....                                                       
                                                                                
                                                                                
                            [100%]

====================================================================================================================================
 FAILURES 
=====================================================================================================================================
_________________________________________________________________________________________________________________
 SslSettingsTest.test_invalid_ssl_version_config 
_________________________________________________________________________________________________________________

self = <cqlshlib.test.test_sslhandling.SslSettingsTest 
testMethod=test_invalid_ssl_version_config>

    def test_invalid_ssl_version_config(self):
>       ssl_ret_val = ssl_settings(self.host, os.path.join('test', 'config', 
> 'sslhandling_invalid.config'))

test/test_sslhandling.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

host = <Host: 10.0.0.1:9042 9000>, config_file = 
'test/config/sslhandling_invalid.config'
env = environ({'SHELL': '/bin/bash', 'QT_ACCESSIBILITY': '1', 'COLORTERM': 
'truecolor', 'PYENV_SHELL': 'bash', 'XDG_CONFIG_D..., 'PYTEST_CURRENT_TEST': 
'cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_invalid_ssl_version_config
 (call)'})

    def ssl_settings(host, config_file, env=os.environ):
        """
        Function which generates SSL setting for cassandra.Cluster
    
        Params:
        * host .........: hostname of Cassandra node.
        * env ..........: environment variables. SSL factory will use, if 
passed,
                          SSL_CERTFILE and SSL_VALIDATE variables.
        * config_file ..: path to cqlsh config file (usually ~/.cqlshrc).
                          SSL factory will use, if set, certfile and validate
                          options in [ssl] section, as well as host to certfile
                          mapping in [certfiles] section.
    
        [certfiles] section is optional, 'validate' setting in [ssl] section is
        optional too. If validation is enabled then SSL certfile must be 
provided
        either in the config file or as an environment variable.
        Environment variables override any options set in cqlsh config file.
        """
        configs = configparser.SafeConfigParser()
        configs.read(config_file)
    
        def get_option(section, option):
            try:
                return configs.get(section, option)
            except configparser.Error:
                return None
    
        def get_best_tls_protocol(ssl_ver_str):
            # newer python versions suggest to use PROTOCOL_TLS to negotiate 
the highest TLS version.
            # older protocol versions have been deprecated:
            # https://docs.python.org/2/library/ssl.html#ssl.PROTOCOL_TLS
            # https://docs.python.org/3/library/ssl.html#ssl.PROTOCOL_TLS
            if ssl_ver_str:
                return getattr(ssl, "PROTOCOL_%s" % ssl_ver_str, None)
            for protocol in ['PROTOCOL_TLS', 'PROTOCOL_TLSv1_2', 
'PROTOCOL_TLSv1_1', 'PROTOCOL_TLSv1']:
                if hasattr(ssl, protocol):
                    return getattr(ssl, protocol)
            return ssl.PROTOCOL_TLS
    
        ssl_validate = env.get('SSL_VALIDATE')
        if ssl_validate is None:
            ssl_validate = get_option('ssl', 'validate')
        ssl_validate = ssl_validate is None or ssl_validate.lower() != 'false'
    
        ssl_version_str = env.get('SSL_VERSION')
        if ssl_version_str is None:
            ssl_version_str = get_option('ssl', 'version')
    
        ssl_version = get_best_tls_protocol(ssl_version_str)
        if ssl_version is None:
>           sys.exit("%s is not a valid SSL protocol, please use one of "
                     "TLS, TLSv1_2, TLSv1_1, or TLSv1" % (ssl_version_str,))
E           SystemExit: invalid_ssl is not a valid SSL protocol, please use one 
of TLS, TLSv1_2, TLSv1_1, or TLSv1

sslhandling.py:74: SystemExit
_____________________________________________________________________________________________________________________
 SslSettingsTest.test_ssl_version_config 
_____________________________________________________________________________________________________________________

self = <cqlshlib.test.test_sslhandling.SslSettingsTest 
testMethod=test_ssl_version_config>

    def test_ssl_version_config(self):
        ssl_ret_val = ssl_settings(self.host, os.path.join('test', 'config', 
'sslhandling.config'))
        assert ssl_ret_val is not None
>       assert ssl_ret_val.get('ssl_version') == getattr(ssl, 'PROTOCOL_TLS')
E       AssertionError: assert <_SSLMethod.PROTOCOL_TLSv1: 3> == 
<_SSLMethod.PROTOCOL_TLS: 2>
E        +  where <_SSLMethod.PROTOCOL_TLSv1: 3> = <built-in method get of dict 
object at 0x7f04d878e700>('ssl_version')
E        +    where <built-in method get of dict object at 0x7f04d878e700> = 
{'ca_certs': None, 'cert_reqs': <VerifyMode.CERT_NONE: 0>, 'certfile': None, 
'keyfile': None, ...}.get
E        +  and   <_SSLMethod.PROTOCOL_TLS: 2> = getattr(ssl, 'PROTOCOL_TLS')

test/test_sslhandling.py:69: AssertionError
================================================================================================================================
 warnings summary 
=================================================================================================================================
../venv/lib/python3.8/site-packages/nose/importer.py:12
  
/tmp/cassandra-trunk/pylib/venv/lib/python3.8/site-packages/nose/importer.py:12:
 DeprecationWarning: the imp module is deprecated in favour of importlib; see 
the module's documentation for alternative uses
    from imp import find_module, load_module, acquire_lock, release_lock

test/run_cqlsh.py:36
  /tmp/cassandra-trunk/pylib/cqlshlib/test/run_cqlsh.py:36: DeprecationWarning: 
invalid escape sequence \S
    DEFAULT_CQLSH_PROMPT = DEFAULT_PREFIX + '(\S+@)?cqlsh(:\S+)?> '

test/test_cqlsh_output.py:766
  /tmp/cassandra-trunk/pylib/cqlshlib/test/test_cqlsh_output.py:766: 
DeprecationWarning: invalid escape sequence \s
    self.assertRegex(output, '.*\s*$')

test/test_cqlsh_output.py:772
  /tmp/cassandra-trunk/pylib/cqlshlib/test/test_cqlsh_output.py:772: 
DeprecationWarning: invalid escape sequence \[
    '^\[cqlsh \S+ \| Cassandra \S+ \| CQL spec \S+ \| Native protocol \S+\]$')

cqlshlib/test/test_cqlsh_completion.py::TestCqlshCompletion::test_complete_command_words
cqlshlib/test/test_cqlsh_completion.py::TestCqlshCompletion::test_complete_on_empty_string
cqlshlib/test/test_cqlsh_output.py::TestCqlshOutput::test_blob_output
cqlshlib/test/test_cqlsh_output.py::TestCqlshOutput::test_describe_keyspace_output
cqlshlib/test/test_cqlsh_output.py::TestCqlshOutput::test_user_types_with_collections
cqlshlib/test/test_unicode.py::TestCqlshUnicode::test_unicode_desc
  
/tmp/cassandra-trunk/pylib/venv/src/cassandra-driver/cassandra/cluster.py:1243: 
DeprecationWarning: Legacy execution parameters will be removed in 4.0. 
Consider using execution profiles.
    warn("Legacy execution parameters will be removed in 4.0. Consider using "

cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_default_ssl_version
cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_invalid_ssl_version_config
cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_invalid_ssl_versions_from_env
cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_ssl_version_config
cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_ssl_versions_from_env
cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_ssl_versions_from_env
cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_ssl_versions_from_env
cqlshlib/test/test_sslhandling.py::SslSettingsTest::test_ssl_versions_from_env
  /tmp/cassandra-trunk/pylib/cqlshlib/sslhandling.py:42: DeprecationWarning: 
The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This 
alias will be removed in future versions. Use ConfigParser directly instead.
    configs = configparser.SafeConfigParser()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================================================================================================
 short test summary info 
=============================================================================================================================
FAILED 
test/test_sslhandling.py::SslSettingsTest::test_invalid_ssl_version_config - 
SystemExit: invalid_ssl is not a valid SSL protocol, please use one of TLS, 
TLSv1_2, TLSv1_1, or TLSv1
FAILED test/test_sslhandling.py::SslSettingsTest::test_ssl_version_config - 
AssertionError: assert <_SSLMethod.PROTOCOL_TLSv1: 3> == 
<_SSLMethod.PROTOCOL_TLS: 2>
==============================================================================================================
 2 failed, 85 passed, 18 warnings in 214.46s (0:03:34) 
==============================================================================================================
+ RETURN=1
+ ccm remove
No currently active cluster (use ccm cluster switch)
+ sed -i 's/testsuite name="nosetests"/testsuite 
name="cqlshlib.python3.jdk8.no_cython"/g' nosetests.xml
sed: can't read nosetests.xml: No such file or directory
+ sed -i 's/testcase classname="cqlshlib./testcase 
classname="cqlshlib.python3.jdk8.no_cython./g' nosetests.xml
sed: can't read nosetests.xml: No such file or directory
+ mv nosetests.xml ../cqlshlib.xml
mv: cannot stat 'nosetests.xml': No such file or directory
+ deactivate
+ unset -f pydoc
+ '[' -z _ ']'
+ 
PATH=/home/bereng/.pyenv/plugins/pyenv-virtualenv/shims:/home/bereng/.pyenv/shims:/home/bereng/.pyenv/bin:/home/bereng/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
+ export PATH
+ unset _OLD_VIRTUAL_PATH
+ '[' -z '' ']'
+ '[' -n /bin/bash ']'
+ hash -r
+ '[' -z _ ']'
+ PS1=
+ export PS1
+ unset _OLD_VIRTUAL_PS1
+ unset VIRTUAL_ENV
+ '[' '!' '' = nondestructive ']'
+ unset -f deactivate
+ command -v circleci
+ exit 1
{noformat}

> Update python test framework from nose to pytest
> ------------------------------------------------
>
>                 Key: CASSANDRA-17293
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17293
>             Project: Cassandra
>          Issue Type: Task
>          Components: CQL/Interpreter
>            Reporter: Brad Schoening
>            Assignee: Brad Schoening
>            Priority: Normal
>             Fix For: 4.x
>
>
> I had trouble trying to install and run the python nose test from pip 
> (nosetest not found).
> According to the homepage of nose at [https://nose.readthedocs.io/en/latest/]
> h1. _Note to Users_
> _Nose has been in maintenance mode for the past several years and will likely 
> cease without a new person/team to take over maintainership. New projects 
> should consider using [Nose2|https://github.com/nose-devs/nose2], 
> [py.test|http://pytest.org/], or just plain unittest/unittest2._
>  
> Upgrading to pytest is likely the least effort. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to