From 40c8700ee501772117c3ecec67a76b97df93b2f0 Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Sun, 15 Mar 2015 15:12:05 +0100 Subject: [PATCH] Adds Python 3 compatibility to the benchmark. --- benchmark.py | 6 ++++-- benchmark_requirements.txt | 4 ---- benchmark_requirements_py2.txt | 4 ++++ benchmark_requirements_py3.txt | 4 ++++ 4 files changed, 12 insertions(+), 6 deletions(-) delete mode 100644 benchmark_requirements.txt create mode 100644 benchmark_requirements_py2.txt create mode 100644 benchmark_requirements_py3.txt diff --git a/benchmark.py b/benchmark.py index 23ec1b4..ef32d96 100755 --- a/benchmark.py +++ b/benchmark.py @@ -21,6 +21,7 @@ from django.contrib.auth.models import User, Group from django.core.cache import get_cache from django.db import connections, connection from django.test.utils import CaptureQueriesContext, override_settings +from django.utils.encoding import force_text import matplotlib.pyplot as plt import MySQLdb import pandas as pd @@ -71,11 +72,12 @@ def write_conditions(): versions['MySQL'] = cursor.fetchone()[0].split('-')[0] cursor.close() # Redis - out = check_output(['redis-cli', 'INFO', 'server']).replace('\r', '') + out = force_text(check_output(['redis-cli', + 'INFO', 'server'])).replace('\r', '') versions['Redis'] = re.search(r'^redis_version:([\d\.]+)$', out, flags=re.MULTILINE).group(1) # memcached - out = check_output(['memcached', '-h']) + out = force_text(check_output(['memcached', '-h'])) versions['memcached'] = re.match(r'^memcached ([\d\.]+)$', out, flags=re.MULTILINE).group(1) diff --git a/benchmark_requirements.txt b/benchmark_requirements.txt deleted file mode 100644 index 606541e..0000000 --- a/benchmark_requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ --r runtests_requirements.txt - -pandas -matplotlib diff --git a/benchmark_requirements_py2.txt b/benchmark_requirements_py2.txt new file mode 100644 index 0000000..7c1be62 --- /dev/null +++ b/benchmark_requirements_py2.txt @@ -0,0 +1,4 @@ +-r runtests_requirements_py2.txt + +pandas +matplotlib diff --git a/benchmark_requirements_py3.txt b/benchmark_requirements_py3.txt new file mode 100644 index 0000000..ff1fa95 --- /dev/null +++ b/benchmark_requirements_py3.txt @@ -0,0 +1,4 @@ +-r runtests_requirements_py3.txt + +pandas +matplotlib