Fix for py33 unittest running
Rework some imports to work with py27 and py33, also fix unittests for config schemas and version checking. This commit is not garantee that application will fully worked on python3.3 Task: https://blueprints.launchpad.net/rubick/+spec/python33-support Signed-off-by: Peter Lomakin <plomakin@mirantis.com> Change-Id: Iffa564d52fd2bf83cebe9f31cca74e27c0b6baad
This commit is contained in:
parent
46c5ad5406
commit
e492c06315
@ -17,7 +17,7 @@ from rubick.model import DirectoryResource
|
||||
def indent_prefix(indent=0):
|
||||
s = ''
|
||||
if indent > 0:
|
||||
for i in xrange(0, indent):
|
||||
for i in range(0, indent):
|
||||
s += ' '
|
||||
return s
|
||||
|
||||
|
@ -4,7 +4,11 @@ import os
|
||||
from paramiko.dsskey import DSSKey
|
||||
from paramiko.rsakey import RSAKey
|
||||
import stat
|
||||
from StringIO import StringIO
|
||||
import sys
|
||||
if sys.version < '3':
|
||||
from StringIO import StringIO
|
||||
else:
|
||||
from io import StringIO
|
||||
|
||||
TMP_KEY_PATH = "/tmp/joker_%s_%d"
|
||||
|
||||
|
@ -10,7 +10,8 @@ honcho==0.4.2
|
||||
jinja2==2.7
|
||||
lettuce>=0.2.19
|
||||
pymongo==2.6.1
|
||||
recordtype==1.1
|
||||
#recordtype==1.1
|
||||
https://bitbucket.org/jstasiak/recordtype/get/default.tar.gz
|
||||
paramiko==1.11.0
|
||||
oslo.config==1.2.1
|
||||
requests==1.2.0
|
||||
|
@ -78,13 +78,40 @@ class Version:
|
||||
return '<Version %s>' % str(self)
|
||||
|
||||
def __cmp__(self, other):
|
||||
for i in xrange(0, 3):
|
||||
for i in range(0, 3):
|
||||
x = self.parts[i] - other.parts[i]
|
||||
if x != 0:
|
||||
return -1 if x < 0 else 1
|
||||
|
||||
return 0
|
||||
|
||||
def __lt__(self, other):
|
||||
for i in range(0, 3):
|
||||
x = self.parts[i] - other.parts[i]
|
||||
if x != 0:
|
||||
return True if x < 0 else False
|
||||
return False
|
||||
|
||||
def __le__(self, other):
|
||||
for i in range(0, 3):
|
||||
x = self.parts[i] - other.parts[i]
|
||||
if x != 0:
|
||||
return True if x < 0 else False
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
for i in range(0, 3):
|
||||
x = self.parts[i] - other.parts[i]
|
||||
if x != 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
def __eq__(self, other):
|
||||
for i in range(0, 3):
|
||||
x = self.parts[i] - other.parts[i]
|
||||
if x != 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class Mark(object):
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
|
||||
from common import *
|
||||
from ini import IniConfigParser
|
||||
from rubick.common import *
|
||||
from rubick.config_formats.ini import IniConfigParser
|
||||
|
@ -1,5 +1,10 @@
|
||||
import re
|
||||
from StringIO import StringIO
|
||||
import sys
|
||||
if sys.version < '3':
|
||||
from StringIO import StringIO
|
||||
else:
|
||||
from io import StringIO
|
||||
|
||||
|
||||
from rubick.config_model import *
|
||||
from rubick.config_formats.common import *
|
||||
|
@ -1,8 +1,8 @@
|
||||
import unittest
|
||||
from contextlib import contextmanager
|
||||
|
||||
from rubick.schema import ConfigSchemaRegistry, Version
|
||||
from rubick.common import find
|
||||
from rubick.schema import ConfigSchemaRegistry
|
||||
from rubick.common import find, Version
|
||||
|
||||
|
||||
class TestConfigSchemaLoader(object):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from rubick.schema import Version
|
||||
from rubick.common import Version
|
||||
|
||||
import unittest
|
||||
|
||||
|
7
tox.ini
7
tox.ini
@ -1,16 +1,11 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = py26,py27,pep8
|
||||
envlist = py26,py27,py33,pep8
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
sitepackages = True
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
LANG=en_US.UTF-8
|
||||
LANGUAGE=en_US:en
|
||||
LC_ALL=C
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
|
Loading…
x
Reference in New Issue
Block a user