copy_tests.py 641 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
import os
from shutil import copytree
import site 


def copy_directory(src, 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()