import luigi
import sciluigi as sl
import os

TESTFILE_PATH = '/tmp/test.out'

class TestTask(sl.Task):

    def out_data(self):
        return sl.TargetInfo(self, TESTFILE_PATH)

    def run(self):
        with self.out_data().open('w') as outfile:
            outfile.write('File written by luigi\n')

class TestRunTask():

    def setup(self):
        self.t = sl.new_task(TestTask)

    def teardown(self):
        self.t = None
        os.remove(TESTFILE_PATH)

    def test_run(self):
        # Run a task with a luigi worker
        w = luigi.worker.Worker()
        w.add(self.t)
        w.run()
        w.stop()

        assert os.path.isfile(TESTFILE_PATH)

import luigi
import sciluigi as sl
import os

TESTFILE_PATH = '/tmp/test.out'

class TestTask(sl.Task):

    def out_data(self):
        return sl.TargetInfo(self, TESTFILE_PATH)

    def run(self):
        with self.out_data().open('w') as outfile:
            outfile.write('File written by luigi\n')

class TestRunTask():

    def setup(self):
        self.t = sl.new_task(self, TestTask, 'testtask')

    def teardown(self):
        self.t = None
        os.remove(TESTFILE_PATH)

    def test_run(self):
        # Run a task with a luigi worker
        w = luigi.worker.Worker()
        w.add(self.t)
        w.run()
        w.stop()

        assert os.path.isfile(TESTFILE_PATH)

Make sure test works with new API
Make sure test works with new API

  import luigi
  import sciluigi as sl
  import os
  
  TESTFILE_PATH = '/tmp/test.out'
  
  class TestTask(sl.Task):
  
      def out_data(self):
          return sl.TargetInfo(self, TESTFILE_PATH)
  
      def run(self):
          with self.out_data().open('w') as outfile:
              outfile.write('File written by luigi\n')
  
  class TestRunTask():
  
      def setup(self):
-         self.t = sl.new_task(TestTask)
+         self.t = sl.new_task(self, TestTask, 'testtask')
  
      def teardown(self):
          self.t = None
          os.remove(TESTFILE_PATH)
  
      def test_run(self):
          # Run a task with a luigi worker
          w = luigi.worker.Worker()
          w.add(self.t)
          w.run()
          w.stop()
  
          assert os.path.isfile(TESTFILE_PATH)
  
Make sure test works with new API
## Code Before:
import luigi
import sciluigi as sl
import os

TESTFILE_PATH = '/tmp/test.out'

class TestTask(sl.Task):

    def out_data(self):
        return sl.TargetInfo(self, TESTFILE_PATH)

    def run(self):
        with self.out_data().open('w') as outfile:
            outfile.write('File written by luigi\n')

class TestRunTask():

    def setup(self):
        self.t = sl.new_task(TestTask)

    def teardown(self):
        self.t = None
        os.remove(TESTFILE_PATH)

    def test_run(self):
        # Run a task with a luigi worker
        w = luigi.worker.Worker()
        w.add(self.t)
        w.run()
        w.stop()

        assert os.path.isfile(TESTFILE_PATH)

## Instruction:
Make sure test works with new API
## Code After:
import luigi
import sciluigi as sl
import os

TESTFILE_PATH = '/tmp/test.out'

class TestTask(sl.Task):

    def out_data(self):
        return sl.TargetInfo(self, TESTFILE_PATH)

    def run(self):
        with self.out_data().open('w') as outfile:
            outfile.write('File written by luigi\n')

class TestRunTask():

    def setup(self):
        self.t = sl.new_task(self, TestTask, 'testtask')

    def teardown(self):
        self.t = None
        os.remove(TESTFILE_PATH)

    def test_run(self):
        # Run a task with a luigi worker
        w = luigi.worker.Worker()
        w.add(self.t)
        w.run()
        w.stop()

        assert os.path.isfile(TESTFILE_PATH)
