Skip to content

Commit

Permalink
Merge pull request #39 from mcmclx/master
Browse files Browse the repository at this point in the history
Make tests python3 compatible
Thanks @mcmclx !
  • Loading branch information
samuell authored Jul 7, 2017
2 parents 89d1f0b + a9e756d commit c69b5a3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import luigi
import sciluigi as sl
import os
import six.moves as s
import time
import unittest

Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit c69b5a3

Please sign in to comment.