Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Django 3.0] Adding compatible versions of other libraries according … #1786

Merged
merged 6 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 137 additions & 65 deletions apps/beeswax/src/beeswax/tests.py

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion apps/jobbrowser/src/jobbrowser/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import json
import logging
import re
import sys
import time
import unittest

Expand Down Expand Up @@ -490,7 +491,10 @@ def test_acls_job(self):
assert_false(can_modify_job('test3', response.context[0]['job']))

response2 = self.c3.get('/jobbrowser/jobs/job_1356251510842_0054')
assert_true(b'don't have permission to access job' in response2.content, response2.content)
if sys.version_info[0] < 3:
assert_true(b'don&#39;t have permission to access job' in response2.content, response2.content)
else:
assert_true(b'don&#x27;t have permission to access job' in response2.content, response2.content)

def test_kill_job(self):
job_id = 'application_1356251510842_0054'
Expand Down
2 changes: 1 addition & 1 deletion apps/oozie/src/oozie/views/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def schedule_workflow(request, workflow):


@check_job_access_permission()
def create_coordinator(request, workflow=None):
def create_coordinator(request, workflow=None, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels kind of invalid but this code should not be used anymore

if workflow is not None:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.2", coordinatorworkflow=workflow)
else:
Expand Down
214 changes: 151 additions & 63 deletions apps/useradmin/src/useradmin/tests.py

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions desktop/core/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ Babel==2.5.1
boto==2.46.1
celery[redis]==4.4.5 # For Python 3.8
cffi==1.13.2
channels==2.1.6
channels-redis==2.3.2
channels==3.0.3
channels-redis==3.2.0
configobj==5.0.6
cryptography==3.3.2
django-auth-ldap==1.3.0
Django==2.2.17
django-auth-ldap==2.3.0
Django==3.0.12
django-axes==5.13.0
django_babel==0.6.2
django-celery-beat==1.4.0
django_celery_results==1.0.4
django-cors-headers==3.7.0
Expand Down Expand Up @@ -64,3 +63,4 @@ sqlparse==0.4.1
tablib==0.13.0
thrift==0.13.0
thrift-sasl==0.4.2
git+git://github.com/agl29/django-babel.git
agl29 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/ldaptestcmd_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.core import management
from django.core.management import get_commands
from django.test import SimpleTestCase
from django.utils.six import StringIO
from six import StringIO

class CmdTests(SimpleTestCase):
def checkcmd(self):
Expand Down
76 changes: 38 additions & 38 deletions desktop/core/src/desktop/management/commands/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from django_nose import runner

#import south.management.commands
from django.utils import six
import six
from django.utils.translation import deactivate
import sys
import textwrap
Expand All @@ -38,57 +38,57 @@
from desktop.lib import django_mako

if six.PY3:
from types import SimpleNamespace
from types import SimpleNamespace
else:
class SimpleNamespace(object):
pass
class SimpleNamespace(object):
pass

class _TestState(object):
pass
pass


def setup_test_environment(debug=None):
"""
Perform global pre-test setup, such as installing the instrumented template
renderer and setting the email backend to the locmem email backend.
"""
if hasattr(_TestState, 'saved_data'):
# Executing this function twice would overwrite the saved values.
raise RuntimeError(
"setup_test_environment() was already called and can't be called "
"again without first calling teardown_test_environment()."
)
"""
Perform global pre-test setup, such as installing the instrumented template
renderer and setting the email backend to the locmem email backend.
"""
if hasattr(_TestState, 'saved_data'):
# Executing this function twice would overwrite the saved values.
raise RuntimeError(
"setup_test_environment() was already called and can't be called "
"again without first calling teardown_test_environment()."
)

if debug is None:
debug = settings.DEBUG
if debug is None:
debug = settings.DEBUG

saved_data = SimpleNamespace()
_TestState.saved_data = saved_data
saved_data = SimpleNamespace()
_TestState.saved_data = saved_data

saved_data.allowed_hosts = settings.ALLOWED_HOSTS
# Add the default host of the test client.
settings.ALLOWED_HOSTS = list(settings.ALLOWED_HOSTS) + ['testserver']
saved_data.allowed_hosts = settings.ALLOWED_HOSTS
# Add the default host of the test client.
settings.ALLOWED_HOSTS = list(settings.ALLOWED_HOSTS) + ['testserver']

saved_data.debug = settings.DEBUG
settings.DEBUG = debug
saved_data.debug = settings.DEBUG
settings.DEBUG = debug

django_mako.render_to_string = django_mako.render_to_string_test
django_mako.render_to_string = django_mako.render_to_string_test

deactivate()
deactivate()


def teardown_test_environment():
"""
Perform any global post-test teardown, such as restoring the original
template renderer and restoring the email sending functions.
"""
saved_data = _TestState.saved_data
"""
Perform any global post-test teardown, such as restoring the original
template renderer and restoring the email sending functions.
"""
saved_data = _TestState.saved_data

settings.ALLOWED_HOSTS = saved_data.allowed_hosts
settings.DEBUG = saved_data.debug
django_mako.render_to_string = django_mako.render_to_string_normal
settings.ALLOWED_HOSTS = saved_data.allowed_hosts
settings.DEBUG = saved_data.debug
django_mako.render_to_string = django_mako.render_to_string_normal

del _TestState.saved_data
del _TestState.saved_data


class Command(BaseCommand):
Expand All @@ -103,8 +103,8 @@ class Command(BaseCommand):
specific Explicitly run specific tests using nose.
For example, to run all the filebrower tests or
to run a specific test function, use
test specific filebrowser
test specific useradmin.tests:test_user_admin
test specific filebrowser
test specific useradmin.tests:test_user_admin
All additional arguments are passed directly to nose.

list_modules List test modules for all desktop applications and libraries
Expand Down Expand Up @@ -141,7 +141,7 @@ def run_from_argv(self, argv):
sys.exit(1)

nose_args = None
all_apps = [ app.module.__name__ for app in appmanager.DESKTOP_MODULES ]
all_apps = [app.module.__name__ for app in appmanager.DESKTOP_MODULES]

if args[0] == "all":
nose_args = args + all_apps
Expand Down