11 def __init__(self, package_name, pkg_files, executables):
22 return os.path.join(tempfile.gettempdir(), self.
package_name)
36 for folder, _, files
in os.walk(self.
root):
37 short_folder = folder.replace(self.
root,
'')
38 if len(short_folder) > 0
and short_folder[0] ==
'/':
39 short_folder = short_folder[1:]
41 the_files.append(os.path.join(short_folder, fn))
44 return set(self.pkg_files.keys())
48 full_path = os.path.join(self.
root, filename)
49 if os.path.exists(full_path):
50 return open(full_path).read().replace(
'\r\n',
'\n')
52 return self.
pkg_files[filename].replace(
'\r\n',
'\n')
56 out_keys = other_package.get_filenames()
57 matches = in_keys.intersection(out_keys)
58 missed_deletes = in_keys - out_keys
59 missed_generations = out_keys - in_keys
60 return matches, missed_deletes, missed_generations
65 for fn, contents
in self.pkg_files.items():
66 outfile = os.path.join(self.
root, fn)
67 parts = outfile.split(os.sep)
70 for i
in range(4, len(parts)):
71 new_folder = os.sep.join(parts[:i])
72 if not os.path.exists(new_folder):
74 with open(outfile,
'w')
as f:
80 if os.path.exists(self.
root):
81 shutil.rmtree(self.
root)
88 file_data = collections.defaultdict(dict)
89 zf = zipfile.ZipFile(zip_filename)
92 for file
in zf.filelist:
93 if file.filename[-1] ==
'/':
95 if file.filename ==
'list_o_tests.yaml':
96 config = yaml.safe_load(zf.read(file))
98 parts = file.filename.split(os.path.sep)
100 path = os.path.join(*parts[1:])
101 file_data[package][path] = zf.read(file).decode()
102 if (file.external_attr >> 16) & 0o111:
103 executables.add(path)
106 for package, D
in file_data.items():
110 D[
'functions'] = [D[
'function']]
112 return config, test_data
def compare_filesets(self, other_package)
def __exit__(self, type, value, traceback)
def __init__(self, package_name, pkg_files, executables)
def get_contents(self, filename)
def get_test_cases(zip_filename)