Пример #1
0
Файл: deps.py Проект: druths/xp
	def test_within_pipeline_graph(self):
		p = get_pipeline(get_complete_filename('dep_test1'),default_prefix=USE_FILE_PREFIX)

		vl = p.get_visitation_list()
		vl = {x[0].name:x[1] for x in vl}	

		self.assertDictEqual(vl,{'t4':0,'t3':1,'t2':1,'t1':2})
Пример #2
0
    def test_varexpand1(self):
        """
		This test case checks:

			- basic variable expansion
			- basic pipeline filename expansion
			- nested pipeline filename expansion
		"""
        p = get_pipeline(get_complete_filename('varexpand1'),
                         default_prefix=USE_FILE_PREFIX)
        p.unmark_all_tasks(recur=True)
        p.run()

        # check the output
        self.assertTrue(
            os.path.exists(get_complete_filename('hello_world.txt')))
        self.assertTrue(
            os.path.exists(
                get_complete_filename('varexpand1_pln_expand1.txt')))
        self.assertTrue(
            os.path.exists(get_complete_filename('varexpand1_hello.txt')))
        self.assertTrue(
            os.path.exists(get_complete_filename('varexpand1_pytest.dat')))

        os.remove(get_complete_filename('hello_world.txt'))
        os.remove(get_complete_filename('varexpand1_pln_expand1.txt'))
        os.remove(get_complete_filename('varexpand1_hello.txt'))
        os.remove(get_complete_filename('varexpand1_pytest.dat'))

        p.unmark_all_tasks(recur=True)
Пример #3
0
Файл: deps.py Проект: druths/xp
	def test_cross_pipeline_graph(self):
		p = get_pipeline(get_complete_filename('dep_test2'),default_prefix=USE_FILE_PREFIX)

		vl = p.get_visitation_list()
		vl = {x[0].name:x[1] for x in vl}	

		self.assertDictEqual(vl,{'p1_t4':0,'p1_t3':1,'p1_t2':1,'p1_t1':2,'p0_t3':3,'p0_t2':4,'p0_t1':5})
Пример #4
0
    def test_within_pipeline_graph(self):
        p = get_pipeline(get_complete_filename('dep_test1'),
                         default_prefix=USE_FILE_PREFIX)

        vl = p.get_visitation_list()
        vl = {x[0].name: x[1] for x in vl}

        self.assertDictEqual(vl, {'t4': 0, 't3': 1, 't2': 1, 't1': 2})
Пример #5
0
	def test_one_property(self):
		p = get_pipeline(get_complete_filename('one_property'),default_prefix=USE_FILE_PREFIX)

		t1 = p.get_task('my_task')
		props = t1.properties()

		self.assertEqual(len(props),1)
		self.assertEqual(props['author'],'Derek Ruths')
Пример #6
0
	def test_overload1(self):
		
		p = get_pipeline(get_complete_filename('overload1'),default_prefix=USE_FILE_PREFIX)
		p.unmark_all_tasks()
		p.run()

		self.assertTrue(os.path.exists(get_complete_filename('overload1_2.txt')))

		os.remove(get_complete_filename('overload1_2.txt'))
Пример #7
0
	def test_awk1(self):
		p = get_pipeline(get_complete_filename('awk1'),
						default_prefix=USE_FILE_PREFIX)
		p.unmark_all_tasks()
		p.run()

		fname = get_complete_filename('awk1_out.txt')

		self.assertTrue(os.path.exists(fname))
		os.remove(fname)
Пример #8
0
    def test_awk1(self):
        p = get_pipeline(get_complete_filename('awk1'),
                         default_prefix=USE_FILE_PREFIX)
        p.unmark_all_tasks()
        p.run()

        fname = get_complete_filename('awk1_out.txt')

        self.assertTrue(os.path.exists(fname))
        os.remove(fname)
Пример #9
0
    def test_overload1(self):

        p = get_pipeline(get_complete_filename('overload1'),
                         default_prefix=USE_FILE_PREFIX)
        p.unmark_all_tasks()
        p.run()

        self.assertTrue(
            os.path.exists(get_complete_filename('overload1_2.txt')))

        os.remove(get_complete_filename('overload1_2.txt'))
Пример #10
0
	def test_basic1(self):
		
		p = get_pipeline(get_complete_filename('gpl_basic1'),default_prefix=USE_FILE_PREFIX)
		p.unmark_all_tasks()
		p.run()

		self.assertTrue(os.path.exists(get_complete_filename('gpl_basic1_output1.png')))
		self.assertTrue(os.path.exists(get_complete_filename('output2.png')))

		os.remove(get_complete_filename('gpl_basic1_output1.png'))
		os.remove(get_complete_filename('output2.png'))
Пример #11
0
    def test_used_pln_expand2(self):
        p = get_pipeline(get_complete_filename('sdir_prefix3'),default_prefix=USE_FILE_PREFIX)
        p.unmark_all_tasks(recur=True)
        p.run()

        # check the output
        self.assertTrue(os.path.exists(get_complete_filename(os.path.join('sdir_foo2','bar','hello_world.txt'))))
        self.assertTrue(os.path.exists(get_complete_filename(os.path.join('sdir_foo','bar','hello_world.txt'))))

        shutil.rmtree(get_complete_filename('sdir_foo'))
        shutil.rmtree(get_complete_filename('sdir_foo2'))

        p.unmark_all_tasks(recur=True)    
Пример #12
0
	def test_used_pln_expand2(self):
		p = get_pipeline(get_complete_filename('sdir_prefix3'),default_prefix=USE_FILE_PREFIX)
		p.unmark_all_tasks(recur=True)
		p.run()

		# check the output
		self.assertTrue(os.path.exists(get_complete_filename(os.path.join('sdir_foo2','bar','hello_world.txt'))))
		self.assertTrue(os.path.exists(get_complete_filename(os.path.join('sdir_foo','bar','hello_world.txt'))))

		shutil.rmtree(get_complete_filename('sdir_foo'))
		shutil.rmtree(get_complete_filename('sdir_foo2'))

		p.unmark_all_tasks(recur=True)	
Пример #13
0
    def test_plnref_varexpand1(self):
        """
        This test case checks:

            - basic variable expansion
            - basic pipeline filename expansion
            - nested pipeline filename expansion
        """
        p = get_pipeline(get_complete_filename('plnref_varexpand1'),default_prefix=USE_FILE_PREFIX)
        context = p.get_context()

        self.assertTrue(context['VAR1'],'test')
        self.assertTrue(context['VAR2'],'varexpand1_test_xyz')
Пример #14
0
    def test_spec_file_prefix(self):
        p = get_pipeline(get_complete_filename('sfile_prefix'),
                         default_prefix=USE_FILE_PREFIX)
        p.unmark_all_tasks(recur=True)
        p.run()

        # check the output
        self.assertTrue(
            os.path.exists(get_complete_filename('sfp_hello_world.txt')))

        os.remove(get_complete_filename('sfp_hello_world.txt'))

        p.unmark_all_tasks(recur=True)
Пример #15
0
    def test_default_dir_prefix(self):
        p = get_pipeline(get_complete_filename('ddir_prefix'),
                         default_prefix=USE_FILE_PREFIX)
        p.unmark_all_tasks(recur=True)
        p.run()

        # check the output
        self.assertTrue(
            os.path.exists(
                get_complete_filename(
                    os.path.join('ddir_prefix_data', 'hello_world.txt'))))

        shutil.rmtree(get_complete_filename('ddir_prefix_data'))

        p.unmark_all_tasks(recur=True)
Пример #16
0
	def test_basic1(self):
		p = get_pipeline(get_complete_filename('pyhmr_test1'),
						default_prefix=USE_FILE_PREFIX)
		p.unmark_all_tasks()
		p.run()

		fname = get_complete_filename('pyhmr_test1.out')

		self.assertTrue(os.path.exists(fname))
		contents = open(fname,'r').read()

		self.assertTrue('test\t2' in contents)
		self.assertTrue('hello\t3' in contents)

		os.remove(fname)
Пример #17
0
    def test_used_pln_expand1(self):
        """
        This test and pln_expand2 (the next one) concerns the rather nuanced interpretation of
        using another pipeline. Only those tasks in the used pipeline are invoked that are in
        the dependency chain for the tasks in the present pipeline.
        """
        p = get_pipeline(get_complete_filename('sdir_prefix2'),default_prefix=USE_FILE_PREFIX)
        p.unmark_all_tasks(recur=True)
        p.run()

        # check the output
        self.assertTrue(os.path.exists(get_complete_filename(os.path.join('sdir_foo2','bar','hello_world.txt'))))

        shutil.rmtree(get_complete_filename('sdir_foo2'))

        p.unmark_all_tasks(recur=True)    
Пример #18
0
	def test_used_pln_expand1(self):
		"""
		This test and pln_expand2 (the next one) concerns the rather nuanced interpretation of
		using another pipeline. Only those tasks in the used pipeline are invoked that are in
		the dependency chain for the tasks in the present pipeline.
		"""
		p = get_pipeline(get_complete_filename('sdir_prefix2'),default_prefix=USE_FILE_PREFIX)
		p.unmark_all_tasks(recur=True)
		p.run()

		# check the output
		self.assertTrue(os.path.exists(get_complete_filename(os.path.join('sdir_foo2','bar','hello_world.txt'))))

		shutil.rmtree(get_complete_filename('sdir_foo2'))

		p.unmark_all_tasks(recur=True)	
Пример #19
0
    def test_cross_pipeline_graph(self):
        p = get_pipeline(get_complete_filename('dep_test2'),
                         default_prefix=USE_FILE_PREFIX)

        vl = p.get_visitation_list()
        vl = {x[0].name: x[1] for x in vl}

        self.assertDictEqual(
            vl, {
                'p1_t4': 0,
                'p1_t3': 1,
                'p1_t2': 1,
                'p1_t1': 2,
                'p0_t3': 3,
                'p0_t2': 4,
                'p0_t1': 5
            })
Пример #20
0
	def test_varexpand1(self):
		"""
		This test case checks:

			- basic variable expansion
			- basic pipeline filename expansion
			- nested pipeline filename expansion
		"""
		p = get_pipeline(get_complete_filename('varexpand1'),default_prefix=USE_FILE_PREFIX)
		p.unmark_all_tasks(recur=True)
		p.run()

		# check the output
		self.assertTrue(os.path.exists(get_complete_filename('hello_world.txt')))
		self.assertTrue(os.path.exists(get_complete_filename('varexpand1_pln_expand1.txt')))
		self.assertTrue(os.path.exists(get_complete_filename('varexpand1_hello.txt')))
		self.assertTrue(os.path.exists(get_complete_filename('varexpand1_pytest.dat')))

		os.remove(get_complete_filename('hello_world.txt'))
		os.remove(get_complete_filename('varexpand1_pln_expand1.txt'))
		os.remove(get_complete_filename('varexpand1_hello.txt'))
		os.remove(get_complete_filename('varexpand1_pytest.dat'))

		p.unmark_all_tasks(recur=True)