From cbf0c9fe584b3f9159fe629b1bc8c1ee90fedc45 Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Fri, 4 Dec 2015 11:20:23 +0100 Subject: [PATCH] tox_plain works for py3 --- bfps/__init__.py | 2 +- bfps/base.py | 6 ++---- bfps/code.py | 2 +- tests/test_plain.py | 6 +++--- tox_plain.ini | 3 ++- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/bfps/__init__.py b/bfps/__init__.py index 08532a02..324c42f6 100644 --- a/bfps/__init__.py +++ b/bfps/__init__.py @@ -49,7 +49,7 @@ except DistributionNotFound: install_info = pickle.load( open(os.path.join(os.path.dirname(here), 'install_info.pickle'), - 'r')) + 'rb')) from .code import code from .fluid_converter import fluid_converter diff --git a/bfps/base.py b/bfps/base.py index 528db826..2ed050f8 100644 --- a/bfps/base.py +++ b/bfps/base.py @@ -48,8 +48,7 @@ class base(object): self.simname = simname return None def cdef_pars(self): - key = self.parameters.keys() - key.sort() + key = sorted(list(self.parameters.keys())) src_txt = '' for i in range(len(key)): if type(self.parameters[key[i]]) == int: @@ -60,8 +59,7 @@ class base(object): src_txt += 'double ' + key[i] + ';\n' return src_txt def cread_pars(self): - key = self.parameters.keys() - key.sort() + key = sorted(list(self.parameters.keys())) src_txt = ('int read_parameters(hid_t data_file_id)\n{\n' + 'hid_t dset, memtype, space;\n' + 'hsize_t dims[1];\n' diff --git a/bfps/code.py b/bfps/code.py index 478ef8ad..bbd2de52 100644 --- a/bfps/code.py +++ b/bfps/code.py @@ -139,7 +139,7 @@ class code(base): raise IOError('header not there:\n' + '{0}\n'.format(os.path.join(bfps.header_dir, 'base.hpp')) + '{0}\n'.format(bfps.dist_loc)) - libraries = ['bfps'] + bfps.install_info['libraries'] + libraries = ['bfps.cpython-34m'] + bfps.install_info['libraries'] command_strings = ['g++'] command_strings += [self.name + '.cpp', '-o', self.name] diff --git a/tests/test_plain.py b/tests/test_plain.py index 596eb0e9..a4f032cc 100755 --- a/tests/test_plain.py +++ b/tests/test_plain.py @@ -46,12 +46,12 @@ def plain(opt): assert(opt.niter_todo % 3 == 0) opt.work_dir = wd + '/N{0:0>3x}_2'.format(opt.n) opt.njobs *= 2 - opt.niter_todo /= 2 + opt.niter_todo = opt.niter_todo//2 c1 = launch(opt, dt = c0.parameters['dt']) c1.compute_statistics() opt.work_dir = wd + '/N{0:0>3x}_3'.format(opt.n) - opt.njobs = 3*opt.njobs/2 - opt.niter_todo = 2*opt.niter_todo/3 + opt.njobs = 3*opt.njobs//2 + opt.niter_todo = 2*opt.niter_todo//3 c2 = launch(opt, dt = c0.parameters['dt']) c2.compute_statistics() # plot energy and enstrophy diff --git a/tox_plain.ini b/tox_plain.ini index 1af8e3cd..ad816b83 100644 --- a/tox_plain.ini +++ b/tox_plain.ini @@ -1,6 +1,7 @@ [tox] -envlist = py27 +envlist = py34 [testenv] +deps = matplotlib whitelist_externals = echo cp -- GitLab