Exemplo n.º 1
0
    def test_create_new_copy_avoiding_file(self):
        p = Copy(ORIGIN_PROJECT)
        p.set_copy_location('/tmp/blah')

        p.avoided_files.append(os.path.join(ORIGIN_PROJECT,'extending/setup.py'))
        p.create_new_copy()
        diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
        self.assertTrue(diff['left_only'] == ['/extending/setup.py'])
Exemplo n.º 2
0
 def test_create_new_copy_modifying_file_name(self):
     p = Copy(ORIGIN_PROJECT)
     p.set_copy_location('/tmp/blah')
     p.add_change(os.path.join(ORIGIN_PROJECT,'extending/setup.py'),'Setup.py')
     p.create_new_copy()
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertTrue(diff['left_only']==['/extending/setup.py'] and 
                     diff['right_only']==['/extending/Setup.py'])
Exemplo n.º 3
0
 def test_modify_file_content(self):
     p = Copy(ORIGIN_PROJECT)
     p.set_copy_location('/tmp/blah')
     p.create_new_copy()
     os.system('echo "hola" > /tmp/dist_project/extending/setup.py')
     p.update_copy(['/tmp/dist_project/extending/setup.py'])
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertFalse(diff['left_only'] or diff['right_only'])
     with open('/tmp/dist_project/extending/setup.py') as f:
         file_content = f.read()
         self.assertTrue(file_content=='hola\n')
Exemplo n.º 4
0
 def test_adding_license(self):
     p = Copy(ORIGIN_PROJECT)
     p.set_copy_location('/tmp/blah')
     license = "this is a test license"
     p.license = license
     p.create_new_copy()
     with open('/tmp/blah/example/setup.py') as f:
         file_content = f.readline()
         self.assertTrue(license in file_content)
Exemplo n.º 5
0
 def test_modify_file_name_several_times(self):
     p = Copy(ORIGIN_PROJECT)
     p.set_copy_location('/tmp/blah')
     p.create_new_copy()
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertFalse(diff['left_only'] or diff['right_only'])
     p.add_change(os.path.join(ORIGIN_PROJECT,'extending/setup.py'),'Setup.py')
     p.update_copy([])
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertTrue(diff['right_only'] == ['/extending/Setup.py'] and diff['left_only'] == ['/extending/setup.py'])
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertTrue(diff['left_only']==['/extending/setup.py'] and 
                     diff['right_only']==['/extending/Setup.py'])
     p.add_change(os.path.join(ORIGIN_PROJECT,'extending/setup.py'),'SETUP.py')
     p.update_copy([])
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertTrue(diff['left_only']==['/extending/setup.py'] and 
                     diff['right_only']==['/extending/SETUP.py'])
     p.remove_change(os.path.join(ORIGIN_PROJECT,'extending/setup.py'))
     p.update_copy([])
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertFalse(diff['left_only'] or diff['right_only'])
Exemplo n.º 6
0
 def test_add_and_remove_file(self):
     p = Copy(ORIGIN_PROJECT)
     p.set_copy_location('/tmp/blah')
     p.create_new_copy()
     p.avoid_file(os.path.join(ORIGIN_PROJECT,'extending/setup.py'))
     p.update_copy([])
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertTrue(diff['left_only']==['/extending/setup.py'])
     p.unavoid_file(os.path.join(ORIGIN_PROJECT,'extending/setup.py'))
     p.update_copy([])
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertFalse(diff['left_only'] or diff['right_only'])
Exemplo n.º 7
0
 def test_create_new_copy(self):
     p = Copy(ORIGIN_PROJECT)
     p.set_copy_location('/tmp/blah')
     p.create_new_copy()
     diff = compare_tree(ORIGIN_PROJECT,'/tmp/blah')
     self.assertFalse(diff['left_only'] or diff['right_only'])