clean up unnecessary usage of the six library (awx only supports py3)

This commit is contained in:
Ryan Petrello
2019-01-24 17:57:08 -05:00
parent 68950d56ca
commit daeeaf413a
58 changed files with 238 additions and 311 deletions

View File

@@ -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)
'''

View File

@@ -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])