Changeset - 33f4baab1260
[Not reviewed]
0 3 0
Branko Majic (branko) - 4 years ago 2020-05-07 22:38:48
branko@majic.rs
MAR-149: Minor syntax fixes for Python 3 in tests for common role:

- Do not use the unicode function (this still might break, need to
test it).
- Fix syntax used for catching exceptions within variables.
- Fix one small linting error related to row length.
3 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
roles/common/molecule/default/tests/test_default.py
Show inline comments
 
@@ -330,7 +330,7 @@ def test_pipreqcheck_virtualenv_packages(host, pip_path, expected_packages):
 
    packages = host.run("sudo -u %s %s freeze --all" % ('pipreqcheck', pip_path))
 

	
 
    # Normalise package names and order.
 
    expected_packages = sorted([unicode(p.lower()) for p in expected_packages])
 
    expected_packages = sorted([p.lower() for p in expected_packages])
 
    actual_packages = sorted(packages.stdout.lower().strip().split("\n"))
 

	
 
    # This is a dummy distro-provided package ignored by the pip-tools.
roles/common/molecule/default/tests/test_parameters_mandatory.py
Show inline comments
 
@@ -46,7 +46,7 @@ def test_ssh_login_mechanisms(host):
 

	
 
    try:
 
        transport.auth_none('')
 
    except paramiko.transport.BadAuthenticationType, err:
 
    except paramiko.transport.BadAuthenticationType as err:
 
        assert err.allowed_types == ['publickey']
 

	
 

	
roles/common/molecule/default/tests/test_parameters_optional.py
Show inline comments
 
@@ -32,7 +32,8 @@ def test_bash_prompt_content(host):
 

	
 
    config = host.file('/etc/profile.d/bash_prompt.sh')
 

	
 
    assert "export PS1='\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[0;36m\\]\\u@\\h[test]:\\w\\$ \\[\\033[0m\\]'" in config.content_string
 
    assert "export PS1='\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[0;36m\\]\\u@\\h[test]:\\w\\$ \\[\\033[0m\\]'" in \
 
        config.content_string
 
    assert "export PS1='\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\u@\\h[test]:\\w\\$ '" in config.content_string
 

	
 

	
 
@@ -62,7 +63,7 @@ def test_ssh_login_mechanisms(host):
 

	
 
    try:
 
        transport.auth_none('')
 
    except paramiko.transport.BadAuthenticationType, err:
 
    except paramiko.transport.BadAuthenticationType as err:
 
        assert err.allowed_types == ['publickey']
 

	
 

	
0 comments (0 inline, 0 general)