Spaces Data
Minimal test - lines (546, 595)
path: .spaces[2].spaces[15].metrics.mi.mi_sei
old: 65.62927846032203
new: 65.62541047672465
path: .spaces[2].spaces[15].metrics.mi.mi_original
old: 69.07867794066905
new: 68.75139408212523
path: .spaces[2].spaces[15].metrics.mi.mi_visual_studio
old: 40.396887684601786
new: 40.20549361527792
path: .spaces[2].spaces[15].metrics.loc.sloc
old: 49.0
new: 50.0
path: .spaces[2].spaces[15].metrics.loc.cloc
old: 18.0
new: 19.0
Code
def copy(self, directory, rootdir=None, *tags, **kwargs):
"""
copy the manifests and associated tests
- directory : directory to copy to
- rootdir : root directory to copy to (if not given from manifests)
- tags : keywords the tests must have
- kwargs : key, values the tests must match
"""
# XXX note that copy does *not* filter the tests out of the
# resulting manifest; it just stupidly copies them over.
# ideally, it would reread the manifests and filter out the
# tests that don't match *tags and **kwargs
# destination
if not os.path.exists(directory):
os.path.makedirs(directory)
else:
# sanity check
assert os.path.isdir(directory)
# tests to copy
tests = self.get(tags=tags, **kwargs)
if not tests:
return # nothing to do!
# root directory
if rootdir is None:
rootdir = self.rootdir
# copy the manifests + tests
manifests = [relpath(manifest, rootdir) for manifest in self.manifests()]
for manifest in manifests:
destination = os.path.join(directory, manifest)
dirname = os.path.dirname(destination)
if not os.path.exists(dirname):
os.makedirs(dirname)
else:
# sanity check
assert os.path.isdir(dirname)
shutil.copy(os.path.join(rootdir, manifest), destination)
missing = self.check_missing(tests)
tests = [test for test in tests if test not in missing]
for test in tests:
if os.path.isabs(test["name"]):
continue
source = test["path"]
destination = os.path.join(directory, relpath(test["path"], rootdir))
shutil.copy(source, destination)
# TODO: ensure that all of the tests are below the from_dir