0001-use-python3-urlparse-namespace.patch
hobo/agent/common/management/commands/hobo_deploy.py | ||
---|---|---|
6 | 6 |
import subprocess |
7 | 7 |
import sys |
8 | 8 |
import tempfile |
9 |
import urlparse |
|
10 | 9 | |
11 | 10 |
from django.conf import settings |
12 | 11 |
from django.core.management.base import BaseCommand, CommandError |
13 | 12 |
from django.core.management import call_command, get_commands |
13 |
from django.utils.six.moves.urllib import parse as urlparse |
|
14 | 14 | |
15 | 15 |
from tenant_schemas.utils import tenant_context |
16 | 16 |
from hobo.multitenant.middleware import TenantMiddleware, TenantNotFound |
hobo/environment/management/commands/cook.py | ||
---|---|---|
21 | 21 |
import sys |
22 | 22 |
import time |
23 | 23 |
import os |
24 |
import urlparse |
|
25 | 24 | |
26 | 25 |
from django.contrib.auth.models import User |
27 | 26 |
from django.contrib.contenttypes.models import ContentType |
... | ... | |
31 | 30 |
from django.db.models import Max |
32 | 31 |
from django.core.exceptions import ValidationError |
33 | 32 |
from django.utils.text import slugify |
33 |
from django.utils.six.moves.urllib import parse as urlparse |
|
34 |
from django.utils.six import string_types |
|
34 | 35 | |
35 | 36 |
from hobo.agent.common.management.commands.hobo_deploy import ( |
36 | 37 |
Command as HoboDeployCommand) |
... | ... | |
74 | 75 |
os.path.join(os.path.dirname(filename), recipe['load-variables-from'])))) |
75 | 76 |
variables.update(recipe.get('variables', {})) |
76 | 77 |
for step in recipe.get('steps', []): |
77 |
action, action_args = step.items()[0]
|
|
78 |
action, action_args = list(step.items())[0]
|
|
78 | 79 |
for arg in action_args: |
79 |
if not isinstance(action_args[arg], basestring):
|
|
80 |
if not isinstance(action_args[arg], string_types):
|
|
80 | 81 |
continue |
81 | 82 |
action_args[arg] = string.Template( |
82 | 83 |
action_args[arg]).substitute(variables) |
hobo/profile/models.py | ||
---|---|---|
17 | 17 |
from django.core.validators import RegexValidator |
18 | 18 |
from django.db import models |
19 | 19 |
from django.utils.translation import ugettext_lazy as _ |
20 | ||
20 |
from django.utils.six import string_types |
|
21 | 21 | |
22 | 22 |
validate_attribute_name = RegexValidator( |
23 | 23 |
r'^[a-z][a-z0-9_]*\Z', |
... | ... | |
68 | 68 | |
69 | 69 |
def as_dict(self): |
70 | 70 |
as_dict = dict([(x, y) for (x, y) in self.__dict__.items() |
71 |
if type(y) in (str, unicode, bool)])
|
|
71 |
if type(y) in (string_types, bool)])
|
|
72 | 72 |
return as_dict |
73 | 73 | |
74 | 74 |
def get_real_kind_display(self): |
tests/test_cook.py | ||
---|---|---|
1 | 1 |
import os |
2 | 2 |
import json |
3 |
import StringIO |
|
4 | ||
3 |
from django.utils import six |
|
5 | 4 |
import pytest |
6 |
from mock import call, mock_open, patch, Mock |
|
5 |
if six.PY3: |
|
6 |
from unittest.mock import call, mock_open, patch, Mock |
|
7 |
else: |
|
8 |
from mock import call, mock_open, patch, Mock |
|
7 | 9 | |
8 | 10 |
from django.contrib.auth.models import User |
9 | 11 |
from django.contrib.contenttypes.models import ContentType |
tests/test_emails.py | ||
---|---|---|
4 | 4 |
import dns.resolver |
5 | 5 |
from dns import name |
6 | 6 |
from dns.rdtypes.ANY import MX, TXT |
7 |
import mock |
|
7 |
from django.utils import six |
|
8 |
if six.PY3: |
|
9 |
import unittest.mock |
|
10 |
else: |
|
11 |
import mock |
|
8 | 12 |
import smtplib |
9 | 13 |
import smtpd |
10 | 14 |
import socket |
tests/test_health_api.py | ||
---|---|---|
1 | 1 |
import json |
2 |
from mock import MagicMock |
|
2 |
from django.utils import six |
|
3 |
if six.PY3: |
|
4 |
from unittest.mock import MagicMock |
|
5 |
else: |
|
6 |
from mock import MagicMock |
|
3 | 7 |
import pytest |
4 | 8 |
import requests |
5 | 9 |
import socket |
tests/test_hobo_deploy.py | ||
---|---|---|
1 | 1 |
""" unit tests (mainly for code coverage) |
2 | 2 |
""" |
3 |
import StringIO |
|
3 |
from django.utils.six.moves import StringIO |
|
4 |
from django.utils import six |
|
4 | 5 |
import os |
5 | 6 |
import sys |
6 | 7 | |
7 | 8 |
import json |
8 | 9 |
import pytest |
9 |
from mock import call, patch, Mock |
|
10 |
if six.PY3: |
|
11 |
from unittest.mock import call, patch, Mock |
|
12 |
else: |
|
13 |
from mock import call, patch, Mock |
|
10 | 14 |
from requests import Response, exceptions |
11 | 15 | |
12 | 16 |
from hobo.agent.common.management.commands.hobo_deploy import ( |
tests/test_import_template.py | ||
---|---|---|
1 | 1 |
import pytest |
2 |
import mock |
|
2 |
from django.utils import six |
|
3 |
if six.PY3: |
|
4 |
from unittest import mock |
|
5 |
else: |
|
6 |
import mock |
|
3 | 7 | |
4 | 8 |
from django.conf import settings |
5 | 9 |
from django.core.management import load_command_class |
tests/test_manager.py | ||
---|---|---|
1 | 1 |
import base64 |
2 | 2 |
import os |
3 |
import StringIO |
|
3 |
from django.utils.six.moves import StringIO
|
|
4 | 4 | |
5 | 5 |
from django.conf import settings |
6 | 6 |
from django.contrib.auth.models import User |
tests/test_matomo_utils.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 | |
3 | 3 |
import json |
4 |
import mock |
|
4 |
from django.utils import six |
|
5 |
if six.PY3: |
|
6 |
from unittest import mock |
|
7 |
else: |
|
8 |
import mock |
|
5 | 9 |
import pytest |
6 | 10 |
from requests import Response |
7 | 11 |
tests/test_matomo_views.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 | |
3 | 3 |
import json |
4 |
import mock |
|
4 |
from django.utils import six |
|
5 |
if six.PY3: |
|
6 |
from unittest import mock |
|
7 |
else: |
|
8 |
import mock |
|
5 | 9 |
import pytest |
6 | 10 |
import re |
7 | 11 |
from requests import Response |
tests_authentic/settings.py | ||
---|---|---|
1 | 1 |
import os.path |
2 |
import __builtin__ as builtin |
|
3 |
from mock import mock_open, patch |
|
2 |
from django.utils.six.moves import builtins |
|
3 |
from django.utils import six |
|
4 |
if six.PY3: |
|
5 |
try: |
|
6 |
from unittest.mock import mock_open, patch |
|
7 |
from past.builtins import execfile |
|
8 |
else: |
|
9 |
from mock import mock_open, patch |
|
4 | 10 |
import os |
5 | 11 | |
6 | 12 |
# Debian defaults |
... | ... | |
8 | 14 | |
9 | 15 |
PROJECT_NAME = 'authentic2-multitenant' |
10 | 16 | |
11 | ||
12 |
with patch.object(builtin, 'open', mock_open(read_data='xxx')): |
|
17 |
with patch.object(builtins, 'open', mock_open(read_data='xxx')): |
|
13 | 18 |
execfile(os.environ['DEBIAN_CONFIG_COMMON']) |
14 | 19 | |
15 | 20 |
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-') |
tests_multipublik/settings.py | ||
---|---|---|
1 | 1 |
import os.path |
2 |
import __builtin__ as builtin |
|
2 |
from six.moves import builtins |
|
3 | 3 |
from mock import mock_open, patch |
4 | 4 | |
5 | 5 |
from hobo.settings import * |
... | ... | |
8 | 8 | |
9 | 9 |
PROJECT_NAME = 'multipublik' |
10 | 10 | |
11 |
with patch.object(builtin, 'open', mock_open(read_data='xxx')): |
|
11 |
with patch.object(builtins, 'open', mock_open(read_data='xxx')):
|
|
12 | 12 |
execfile(os.path.join(os.path.dirname(__file__), '../debian/debian_config_common.py')) |
13 | 13 | |
14 | 14 |
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-') |
tox.ini | ||
---|---|---|
4 | 4 |
# and then run "tox" from this directory. |
5 | 5 |
[tox] |
6 | 6 |
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/hobo |
7 |
envlist = coverage-{authentic,hobo,multipublik,multitenant,passerelle,schemas},
|
|
7 |
envlist = {py2,py3}-coverage-hobo,py2-coverage-{authentic,multipublik,multitenant,passerelle,schemas},
|
|
8 | 8 | |
9 | 9 |
[testenv] |
10 |
basepython = python2 |
|
11 | 10 |
whitelist_externals = |
12 | 11 |
/bin/mv |
13 | 12 |
usedevelop = True |
... | ... | |
52 | 51 |
requests |
53 | 52 |
pytest-freezegun |
54 | 53 |
commands = |
55 |
./getlasso.sh |
|
54 |
py2: ./getlasso.sh |
|
55 |
py3: ./getlasso3.sh |
|
56 | 56 |
hobo: py.test {env:COVERAGE:} {env:NOMIGRATIONS:} {posargs:tests/} |
57 | 57 |
schemas: py.test {env:COVERAGE:} {env:NOMIGRATIONS:} {posargs:tests_schemas/} |
58 | 58 |
multitenant: py.test {env:COVERAGE:} {env:NOMIGRATIONS:} {posargs:tests_multitenant/} |
59 |
- |