From a9e756d20f4a3bd5b9b1b89b351d99e6a9ea98e0 Mon Sep 17 00:00:00 2001 From: Mike McCall Date: Thu, 6 Jul 2017 23:21:18 -0400 Subject: [PATCH] Making unit tests python3 compatible --- test/test_dependencies.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/test_dependencies.py b/test/test_dependencies.py index 402419a..0799dfa 100644 --- a/test/test_dependencies.py +++ b/test/test_dependencies.py @@ -2,6 +2,7 @@ import luigi import sciluigi as sl import os +import six.moves as s import time import unittest @@ -21,7 +22,7 @@ class MultiOutTask(sl.Task): an_id = luigi.Parameter() def out_multi(self): - return [sl.TargetInfo(self, '/tmp/out_%s_%d.txt' % (self.an_id, i)) for i in xrange(10)] + return [sl.TargetInfo(self, '/tmp/out_%s_%d.txt' % (self.an_id, i)) for i in s.range(10)] def run(self): for otgt in self.out_multi(): with otgt.open('w') as ofile: @@ -70,15 +71,15 @@ def test_workflow(self): self.w.run() # Assert outputs exists - for p in ['/tmp/out_%s_%d.txt' % (aid, i) for i in xrange(10) for aid in ['x']]: + for p in ['/tmp/out_%s_%d.txt' % (aid, i) for i in s.range(10) for aid in ['x']]: self.assertTrue(os.path.exists(p)) - for p in ['/tmp/out_%s_%d.txt.daa.txt' % (aid, i) for i in xrange(10) for aid in ['x']]: + for p in ['/tmp/out_%s_%d.txt.daa.txt' % (aid, i) for i in s.range(10) for aid in ['x']]: self.assertTrue(os.path.exists(p)) # Remove - for p in ['/tmp/out_%s_%d.txt' % (aid, i) for i in xrange(10) for aid in ['x']]: + for p in ['/tmp/out_%s_%d.txt' % (aid, i) for i in s.range(10) for aid in ['x']]: os.remove(p) - for p in ['/tmp/out_%s_%d.txt.daa.txt' % (aid, i) for i in xrange(10) for aid in ['x']]: + for p in ['/tmp/out_%s_%d.txt.daa.txt' % (aid, i) for i in s.range(10) for aid in ['x']]: os.remove(p) def tearDown(self):