Skip to content

Commit

Permalink
Update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Dec 26, 2019
1 parent 2d5eae9 commit 02fd9b3
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 19 deletions.
5 changes: 3 additions & 2 deletions ckan/lib/io.py
Expand Up @@ -8,8 +8,9 @@

import six

_FILESYSTEM_ENCODING = six.text_type(sys.getfilesystemencoding()
or sys.getdefaultencoding())
_FILESYSTEM_ENCODING = six.text_type(
sys.getfilesystemencoding() or sys.getdefaultencoding()
)


def encode_path(p):
Expand Down
1 change: 0 additions & 1 deletion ckan/tests/helpers.py
Expand Up @@ -314,7 +314,6 @@ def setup(self):
redis_conn.srem(rq.Queue.redis_queues_keys, queue._key)
redis_conn.delete(queue._key)


def all_jobs(self):
u"""
Get a list of all RQ jobs.
Expand Down
1 change: 0 additions & 1 deletion ckan/tests/lib/test_changes.py
Expand Up @@ -106,7 +106,6 @@ def test_change_extra(self):
assert changes[0]["old_value"] == u"science"
assert changes[0]["new_value"] == u"scientific"


def test_change_multiple_extras(self):
changes = []
original = Dataset(
Expand Down
8 changes: 4 additions & 4 deletions ckan/tests/lib/test_i18n.py
Expand Up @@ -142,14 +142,14 @@ def test_translations_from_extensions(self):
class TestI18nFlaskAndPylons(object):
def test_translation_works_on_flask_and_pylons(self, app):
resp = app.get(u"/flask_translated")
assert six.ensure_text(resp.body) == six.text_type("Dataset")
assert six.ensure_text(resp.body) == six.text_type(u"Dataset")

resp = app.get(u"/es/flask_translated")
assert six.ensure_text(resp.body) == six.text_type("Conjunto de datos")
assert six.ensure_text(resp.body) == six.text_type(u"Conjunto de datos")

if six.PY2:
resp = app.get(u"/pylons_translated")
assert six.ensure_text(resp.body) == six.text_type("Groups")
assert six.ensure_text(resp.body) == six.text_type(u"Groups")

resp = app.get(u"/es/pylons_translated")
assert six.ensure_text(resp.body) == six.text_type("Grupos")
assert six.ensure_text(resp.body) == six.text_type(u"Grupos")
1 change: 0 additions & 1 deletion ckan/tests/lib/test_mailer.py
Expand Up @@ -17,7 +17,6 @@
from ckan.tests.legacy.mock_mail_server import SmtpServerHarness



class MailerBase(object):
def mime_encode(self, msg, recipient_name):
text = MIMEText(msg.encode("utf-8"), "plain", "utf-8")
Expand Down
1 change: 1 addition & 0 deletions ckan/tests/logic/action/test_create.py
Expand Up @@ -121,6 +121,7 @@ def test_user_name_lowercase_when_email_is_uppercase(self, _):
assert invited_user.name.split("-")[0] == "maria"

@pytest.mark.ckan_config("smtp.server", "email.example.com")
@pytest.mark.usefixtures("with_request_context")
def test_smtp_error_returns_error_message(self):

sysadmin = factories.Sysadmin()
Expand Down
20 changes: 12 additions & 8 deletions ckan/tests/pytest_ckan/fixtures.py
Expand Up @@ -222,11 +222,13 @@ def __init__(self):
def __call__(self, *args):
return self

def sendmail(self, from_addr, to_addrs, msg, mail_options=(), rcpt_options=()):

self._msgs.append(
(None, from_addr, to_addrs, msg)
)
def sendmail(self,
from_addr,
to_addrs,
msg,
mail_options=(),
rcpt_options=()):
self._msgs.append((None, from_addr, to_addrs, msg))

def get_smtp_messages(self):
return self._msgs
Expand All @@ -240,7 +242,7 @@ def mail_server(monkeypatch):
"""Catch all outcome mails.
"""
bag = FakeSMTP()
monkeypatch.setattr(smtplib, 'SMTP', bag)
monkeypatch.setattr(smtplib, u"SMTP", bag)
yield bag


Expand All @@ -249,6 +251,8 @@ def with_test_worker(monkeypatch):
"""Worker that doesn't create forks.
"""
if six.PY3:
monkeypatch.setattr(rq.Worker, 'main_work_horse', rq.SimpleWorker.main_work_horse)
monkeypatch.setattr(rq.Worker, 'execute_job', rq.SimpleWorker.execute_job)
monkeypatch.setattr(rq.Worker, u"main_work_horse",
rq.SimpleWorker.main_work_horse)
monkeypatch.setattr(rq.Worker, u"execute_job",
rq.SimpleWorker.execute_job)
yield
2 changes: 1 addition & 1 deletion ckanext/datastore/tests/test_chained_action.py
Expand Up @@ -45,7 +45,7 @@ def get_actions(self):
}


@pytest.mark.usefixtures("with_request_context")
@pytest.mark.usefixtures(u"with_request_context")
class TestChainedAction(object):
@pytest.mark.ckan_config(
u"ckan.plugins",
Expand Down
2 changes: 1 addition & 1 deletion ckanext/datastore/tests/test_chained_auth_functions.py
Expand Up @@ -50,7 +50,7 @@ def get_auth_functions(self):
@pytest.mark.ckan_config(
u"ckan.plugins", u"datastore example_data_store_search_sql_plugin"
)
@pytest.mark.usefixtures("with_request_context", u"with_plugins", u"clean_db")
@pytest.mark.usefixtures(u"with_request_context", u"with_plugins", u"clean_db")
class TestChainedAuth(object):
def test_datastore_search_sql_auth(self):
ctd.CreateTestData.create()
Expand Down

0 comments on commit 02fd9b3

Please sign in to comment.