import os from shutil import copytree, rmtree import site def copy_directory(src, dest, directory): rmtree(os.path.join(dest, directory)) copytree(os.path.join(src, directory), os.path.join(dest, directory)) def copy(): here = os.getcwd(); package_locations = site.getsitepackages() for root_path in package_locations: dirs = [x[0] for x in os.walk(root_path)] for dirx in dirs: if dirx.endswith('testsuite'): src = dirx dest = os.path.join(here, 'test') copy_directory(src, dest, 'features') copy_directory(src, dest, 'fixtures') if __name__ == '__main__': copy()