mantl / terraform.py

Ansible dynamic inventory script for parsing Terraform state files
Apache License 2.0
451 stars 122 forks source link

Update unicode keywords for python3 #66

Closed anross closed 3 years ago

anross commented 7 years ago

Testing:

Pre-patch test run:

========================================================== FAILURES ==========================================================
_______________________________________________________ pyflakes-check _______________________________________________________
/home/anross/Github/anross/terraform.py/src/ati/terraform.py:55: inconsistent use of tabs and spaces in indentation
    if type(source) in [unicode, str]:
                                   ^
________________________________________________________ mccabe-check ________________________________________________________
/home/anross/Github/anross/terraform.py/src/ati/terraform.py:55: inconsistent use of tabs and spaces in indentation
    if type(source) in [unicode, str]:
                                   ^
====================================================== warnings summary ======================================================
None
  [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.

-- Docs: http://doc.pytest.org/en/latest/warnings.html
================================ 2 failed, 348 passed, 23 skipped, 1 warnings in 1.22 seconds ================================

Post patch:


_______________________________________________________ pyflakes-check _______________________________________________________
/home/aross/Github/anross/terraform.py/src/ati/terraform.py:55: UndefinedName
undefined name 'unicode'
__________________________________________________ test_attrs[tags-should3] __________________________________________________

scaleway_resource = {'depends_on': ['data.scaleway_image.ubuntu'], 'primary': {'attributes': {'enable_ipv6': 'false', 'id': 'a982f5e3-5ad4...424de25fe84', 'name': 'test-server-01', ...}, 'id': 'a982f5e3-5ad4-4c01-b4bf-f47a7b834e43'}, 'type': 'scaleway_server'}
scaleway_host = <function scaleway_host at 0x7f152929dae8>, attr = 'tags', should = ['dev', 'frontend', 'lga']

    @pytest.mark.parametrize('attr,should', {
        'enable_ipv6': 'false',
        'id': 'a982f5e3-5ad4-4c01-b4bf-f47a7b834e43',
        'image': '7258ac9b-61e7-4f69-a72d-b424de25fe84',
        'name': 'test-server-01',
        'private_ip': '55.55.55.55',
        'public_ip': '77.77.77.77',
        'state': 'running',
        'state_detail': 'booted',
        'tags': ['dev', 'frontend', 'lga'],
        'type': 'VC1M',
        # ansible
        'ansible_ssh_host': '77.77.77.77',
        'ansible_ssh_user': 'root',
        # generic
        'private_ipv4': '55.55.55.55',
        'public_ipv4': '77.77.77.77',
        'provider': 'scaleway',
    }.items())
    def test_attrs(scaleway_resource, scaleway_host, attr, should):
        _, attrs, _ = scaleway_host(scaleway_resource, 'module_name')
        assert attr in attrs
>       assert attrs[attr] == should
E       AssertionError: assert ['lga', 'dev', 'frontend'] == ['dev', 'frontend', 'lga']
E         At index 0 diff: 'lga' != 'dev'
E         Use -v to get the full diff

tests/test_scaleway.py:70: AssertionError
====================================================== warnings summary ======================================================
None
  [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.

-- Docs: http://doc.pytest.org/en/latest/warnings.html
================================ 2 failed, 348 passed, 23 skipped, 1 warnings in 1.32 seconds ================================```