mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 06:26:00 -03:30
clean up unnecessary usage of the six library (awx only supports py3)
This commit is contained in:
@@ -19,7 +19,6 @@ from django.utils.encoding import smart_str, smart_bytes
|
||||
from awx.main.expect import run, isolated_manager
|
||||
|
||||
from django.conf import settings
|
||||
import six
|
||||
|
||||
HERE, FILENAME = os.path.split(__file__)
|
||||
|
||||
@@ -107,7 +106,7 @@ def test_cancel_callback_error():
|
||||
|
||||
|
||||
@pytest.mark.timeout(3) # https://github.com/ansible/tower/issues/2391#issuecomment-401946895
|
||||
@pytest.mark.parametrize('value', ['abc123', six.u('Iñtërnâtiônàlizætiøn')])
|
||||
@pytest.mark.parametrize('value', ['abc123', 'Iñtërnâtiônàlizætiøn'])
|
||||
def test_env_vars(value):
|
||||
stdout = StringIO()
|
||||
status, rc = run.run_pexpect(
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
import six
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from rest_framework.serializers import ValidationError as DRFValidationError
|
||||
@@ -152,8 +151,7 @@ def test_cred_type_injectors_schema(injectors, valid):
|
||||
)
|
||||
field = CredentialType._meta.get_field('injectors')
|
||||
if valid is False:
|
||||
with pytest.raises(ValidationError, message=six.text_type(
|
||||
"Injector was supposed to throw a validation error, data: {}").format(injectors)):
|
||||
with pytest.raises(ValidationError, message="Injector was supposed to throw a validation error, data: {}".format(injectors)):
|
||||
field.clean(injectors, type_)
|
||||
else:
|
||||
field.clean(injectors, type_)
|
||||
|
||||
@@ -14,7 +14,6 @@ from backports.tempfile import TemporaryDirectory
|
||||
import fcntl
|
||||
from unittest import mock
|
||||
import pytest
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from django.conf import settings
|
||||
@@ -1562,7 +1561,7 @@ class TestJobCredentials(TestJobExecution):
|
||||
self.task.run(self.pk)
|
||||
|
||||
def test_custom_environment_injectors_with_unicode_content(self):
|
||||
value = six.u('Iñtërnâtiônàlizætiøn')
|
||||
value = 'Iñtërnâtiônàlizætiøn'
|
||||
some_cloud = CredentialType(
|
||||
kind='cloud',
|
||||
name='SomeCloud',
|
||||
|
||||
@@ -9,7 +9,6 @@ from awx.main.utils.filters import SmartFilter, ExternalLoggerEnabled
|
||||
# Django
|
||||
from django.db.models import Q
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@pytest.mark.parametrize('params, logger_name, expected', [
|
||||
@@ -111,7 +110,7 @@ class TestSmartFilterQueryFromString():
|
||||
])
|
||||
def test_query_generated(self, mock_get_host_model, filter_string, q_expected):
|
||||
q = SmartFilter.query_from_string(filter_string)
|
||||
assert six.text_type(q) == six.text_type(q_expected)
|
||||
assert str(q) == str(q_expected)
|
||||
|
||||
@pytest.mark.parametrize("filter_string", [
|
||||
'ansible_facts__facts__facts__blank='
|
||||
@@ -138,7 +137,7 @@ class TestSmartFilterQueryFromString():
|
||||
])
|
||||
def test_unicode(self, mock_get_host_model, filter_string, q_expected):
|
||||
q = SmartFilter.query_from_string(filter_string)
|
||||
assert six.text_type(q) == six.text_type(q_expected)
|
||||
assert str(q) == str(q_expected)
|
||||
|
||||
@pytest.mark.parametrize("filter_string,q_expected", [
|
||||
('(a=b)', Q(**{u"a": u"b"})),
|
||||
@@ -154,7 +153,7 @@ class TestSmartFilterQueryFromString():
|
||||
])
|
||||
def test_boolean_parenthesis(self, mock_get_host_model, filter_string, q_expected):
|
||||
q = SmartFilter.query_from_string(filter_string)
|
||||
assert six.text_type(q) == six.text_type(q_expected)
|
||||
assert str(q) == str(q_expected)
|
||||
|
||||
@pytest.mark.parametrize("filter_string,q_expected", [
|
||||
('ansible_facts__a__b__c[]=3', Q(**{u"ansible_facts__contains": {u"a": {u"b": {u"c": [3]}}}})),
|
||||
@@ -177,7 +176,7 @@ class TestSmartFilterQueryFromString():
|
||||
])
|
||||
def test_contains_query_generated(self, mock_get_host_model, filter_string, q_expected):
|
||||
q = SmartFilter.query_from_string(filter_string)
|
||||
assert six.text_type(q) == six.text_type(q_expected)
|
||||
assert str(q) == str(q_expected)
|
||||
|
||||
@pytest.mark.parametrize("filter_string,q_expected", [
|
||||
#('a__b__c[]="true"', Q(**{u"a__b__c__contains": u"\"true\""})),
|
||||
@@ -187,7 +186,7 @@ class TestSmartFilterQueryFromString():
|
||||
])
|
||||
def test_contains_query_generated_unicode(self, mock_get_host_model, filter_string, q_expected):
|
||||
q = SmartFilter.query_from_string(filter_string)
|
||||
assert six.text_type(q) == six.text_type(q_expected)
|
||||
assert str(q) == str(q_expected)
|
||||
|
||||
@pytest.mark.parametrize("filter_string,q_expected", [
|
||||
('ansible_facts__a=null', Q(**{u"ansible_facts__contains": {u"a": None}})),
|
||||
@@ -195,7 +194,7 @@ class TestSmartFilterQueryFromString():
|
||||
])
|
||||
def test_contains_query_generated_null(self, mock_get_host_model, filter_string, q_expected):
|
||||
q = SmartFilter.query_from_string(filter_string)
|
||||
assert six.text_type(q) == six.text_type(q_expected)
|
||||
assert str(q) == str(q_expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("filter_string,q_expected", [
|
||||
@@ -213,7 +212,7 @@ class TestSmartFilterQueryFromString():
|
||||
])
|
||||
def test_search_related_fields(self, mock_get_host_model, filter_string, q_expected):
|
||||
q = SmartFilter.query_from_string(filter_string)
|
||||
assert six.text_type(q) == six.text_type(q_expected)
|
||||
assert str(q) == str(q_expected)
|
||||
|
||||
|
||||
'''
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import six
|
||||
|
||||
from awx.main.models import Job, JobEvent
|
||||
|
||||
@@ -15,7 +14,7 @@ def test_log_from_job_event_object():
|
||||
|
||||
# Check entire body of data for any exceptions from getattr on event object
|
||||
for fd in data_for_log:
|
||||
if not isinstance(data_for_log[fd], six.string_types):
|
||||
if not isinstance(data_for_log[fd], str):
|
||||
continue
|
||||
assert 'Exception' not in data_for_log[fd], 'Exception delivered in data: {}'.format(data_for_log[fd])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user