Example #1
0
        class MyTaskB(SimpleTask):
            outputs = File(TEST_DIR, 'out_B.txt')
            inputs = File(TEST_DIR, 'in_B.txt')

            def run(self):
                self.inputs.open('r').read()
                self.outputs.open('w').write('yo')
Example #2
0
        class MyTask(SimpleTask):
            outputs = {
                'A': File(TEST_DIR, 'a.txt'),
                'B': File(TEST_DIR, 'b.txt')
            }

            def run(self):
                self.outputs['A'].open('w').write('yes')
                self.outputs['B'].open('w').write('yes')
Example #3
0
        class MyTask(SimpleTask):
            outputs = {
                'A': File(TEST_DIR, 'out_A.txt', static=True),
                'B': File(TEST_DIR, 'out_B.txt'),
            }
            inputs = {
                'A': File(TEST_DIR, 'in_A.txt', static=True),
                'B': File(TEST_DIR, 'in_B.txt')
            }

            def run(self):
                self.inputs['A'].open('r').read()
                self.inputs['B'].open('r').read()
                self.outputs['A'].open('w').write('yo')
                self.outputs['B'].open('w').write('yo')
Example #4
0
	def test_resource_inheritance(self):

		# a Resource's clobber flag is set by get_ready
		my_file = File('.', 'file.txt')
		my_file.get_ready(lot='my_lot', pilot=False, name='name', 
			clobber=True)
		self.assertTrue(my_file.get_clobber())

		# it's overriden by instantiation keyword argument
		self.assertTrue(File('.', 'file.txt', clobber=True).get_clobber())

		# instantiation gets the last word
		my_file = File('.', 'file.txt', clobber=True)
		my_file.get_ready(lot='my_lot', pilot=False, name='name', 
			clobber=False)
		self.assertTrue(my_file.get_clobber())

		# instantiation gets the last word
		my_file = File('.', 'file.txt', clobber=False)
		my_file.get_ready(lot='my_lot', pilot=False, name='name', 
			clobber=True)
		self.assertFalse(my_file.get_clobber())


		class MyFile(File):
			clobber = True

		# this resource clobbers by default
		self.assertTrue(MyFile('.', 'file.txt').get_clobber())

		# that behavior is overriden by instantiation keyword argument
		self.assertFalse(MyFile('.', 'file.txt', clobber=False).get_clobber())

		# it's not overridden by argument passed to get_ready
		my_file = MyFile('.', 'file.txt')
		my_file.get_ready(lot='my_lot', pilot=False, name='name', 
			clobber=False)
		self.assertTrue(my_file.get_clobber())


		class MyFile(File):
			clobber = False

		# this resource does not clobber by default
		self.assertFalse(MyFile('.', 'file.txt').get_clobber())

		# that behavior is overriden by instantiation keyword argument
		self.assertTrue(MyFile('.', 'file.txt', clobber=True).get_clobber())

		# it's not overridden by argument passed to get_ready
		my_file = MyFile('.', 'file.txt')
		my_file.get_ready(lot='my_lot', pilot=False, name='name', 
			clobber=True)
		self.assertFalse(my_file.get_clobber())
Example #5
0
 def _outputs(self):
     fname = 'test%d.txt' % self.parameters['file_num']
     return File(TEST_DIR, fname)
Example #6
0
    def test_resource_inheritance(self):

        # a Resource's clobber flag is set by get_ready
        my_file = File('.', 'file.txt')
        my_file.get_ready(lot='my_lot', pilot=False, name='name', clobber=True)
        self.assertTrue(my_file.get_clobber())

        # it's overriden by instantiation keyword argument
        self.assertTrue(File('.', 'file.txt', clobber=True).get_clobber())

        # instantiation gets the last word
        my_file = File('.', 'file.txt', clobber=True)
        my_file.get_ready(lot='my_lot',
                          pilot=False,
                          name='name',
                          clobber=False)
        self.assertTrue(my_file.get_clobber())

        # instantiation gets the last word
        my_file = File('.', 'file.txt', clobber=False)
        my_file.get_ready(lot='my_lot', pilot=False, name='name', clobber=True)
        self.assertFalse(my_file.get_clobber())

        class MyFile(File):
            clobber = True

        # this resource clobbers by default
        self.assertTrue(MyFile('.', 'file.txt').get_clobber())

        # that behavior is overriden by instantiation keyword argument
        self.assertFalse(MyFile('.', 'file.txt', clobber=False).get_clobber())

        # it's not overridden by argument passed to get_ready
        my_file = MyFile('.', 'file.txt')
        my_file.get_ready(lot='my_lot',
                          pilot=False,
                          name='name',
                          clobber=False)
        self.assertTrue(my_file.get_clobber())

        class MyFile(File):
            clobber = False

        # this resource does not clobber by default
        self.assertFalse(MyFile('.', 'file.txt').get_clobber())

        # that behavior is overriden by instantiation keyword argument
        self.assertTrue(MyFile('.', 'file.txt', clobber=True).get_clobber())

        # it's not overridden by argument passed to get_ready
        my_file = MyFile('.', 'file.txt')
        my_file.get_ready(lot='my_lot', pilot=False, name='name', clobber=True)
        self.assertFalse(my_file.get_clobber())