Skip to content

Commit

Permalink
Py3: Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
katyukha committed Sep 15, 2015
1 parent 20e1697 commit ab9ff4f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -3,7 +3,7 @@ python:
- "2.7"
- "3.3"
- "3.4"
# - "3.5"
- "3.5"

env:
- ODOO_VERSION="8.0" ODOO_PACKAGE="odoo" ODOO_TEST_PROTOCOL='xml-rpc'
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
@@ -1,4 +1,4 @@
include README.md LICENSE CHANGELOG
include README.rst LICENSE CHANGELOG.rst
include docs/Makefile
recursive-include docs/source *
global-exclude *.swp *.swo
12 changes: 6 additions & 6 deletions openerp_proxy/service/report.py
Expand Up @@ -75,7 +75,7 @@ def content(self):
"""
if self._content is None:
import base64
self._content = base64.decodestring(self.result)
self._content = base64.b64decode(self.result.encode('utf-8'))
return self._content

@property
Expand All @@ -84,11 +84,11 @@ def path(self):
"""
if self._path is None:
import hashlib
content_hash = hashlib.sha256(self.result).hexdigest()
report_name_base = self._report.report_action.name
report_name_base = report_name_base.replace('/', '-')\
.replace(':', '-')
self._path = report_name_base + content_hash + '.' + self.format
content_hash = hashlib.sha256(self.content).hexdigest().encode('utf-8')
report_name_base = self._report.report_action.name.encode('utf-8')
report_name_base = report_name_base.replace(b'/', b'-')\
.replace(b':', b'-')
self._path = str(report_name_base + content_hash + b'.' + self.format.encode('utf-8'))
return self._path

def save(self, path=None):
Expand Down
2 changes: 1 addition & 1 deletion openerp_proxy/tests/ext/test_workflow.py
Expand Up @@ -12,7 +12,7 @@
RecordList)


@unittest.skipUnless(os.environ.get('TEST_WITH_EXTENSIONS', False), 'requires tests enabled')
@unittest.skipUnless(os.environ.get('TEST_WITH_EXTENSIONS', False), 'requires extensions enabled')
class Test_32_ExtWorkFlow(BaseTestCase):
def setUp(self):
super(Test_32_ExtWorkFlow, self).setUp()
Expand Down
10 changes: 6 additions & 4 deletions openerp_proxy/tests/test_ipynb.py
Expand Up @@ -88,7 +88,7 @@ def handle_iopub_for_msg(self, cell, msg_id):
content = msg['content']

# set the prompt number for the input and the output
if 'execution_count' in content:
if cell and 'execution_count' in content:
cell['execution_count'] = content['execution_count']

if msg_type == 'status':
Expand Down Expand Up @@ -145,10 +145,12 @@ def inspect_cell(self, cell):

def _prepare_run(self):
# enable coverage:
self.kc.execute(
"import os, coverage;\n"
import sys
msg_id = self.kc.execute(
"import sys, os, coverage;\n"
"_coverage = coverage.control.coverage(data_suffix='%s-ipython' % os.getpid());\n"
"_coverage.start()\n")
"_coverage.start();\n"
)

reply = self.kc.get_shell_msg(timeout=20)['content']
if reply['status'] == 'error':
Expand Down
7 changes: 4 additions & 3 deletions run_tests.bash
Expand Up @@ -54,16 +54,17 @@ PY_VERSIONS=${PY_VERSIONS:-"2.7 3.4"};


if [ ! -z $TEST_MODULE ]; then
TEST_MODULE_OPT=" --test-suite=\"$TEST_MODULE\"";
TEST_MODULE_OPT=" --test-suite=$TEST_MODULE";
fi

# run_single_test <python version>
function run_single_test {
local py_version=$1;
(cd $SCRIPTPATH && \
virtualenv venv_test -p python${py_version} && \
virtualenv --no-site-packages -p python${py_version} venv_test&& \
source ./venv_test/bin/activate && \
pip install --upgrade pip pudb && \
pip install --upgrade pip setuptools pbr && \
pip install --upgrade coverage six extend_me requests mock pudb ipython[notebook] && \
coverage run -p setup.py test $TEST_MODULE_OPT && \
deactivate && \
rm -rf venv_test
Expand Down

0 comments on commit ab9ff4f

Please sign in to comment.