summaryrefslogtreecommitdiffstats
path: root/apex/build.py
diff options
context:
space:
mode:
authorDan Radez <dradez@redhat.com>2017-09-14 09:56:36 -0400
committerTim Rozet <trozet@redhat.com>2017-09-25 13:50:09 +0000
commit96e8ffec3e9534f4cc131303334cb2d93179feed (patch)
treead2498f6bb4e3a36d98ab12e62595730e14a9ca0 /apex/build.py
parentf3c3009535b3c64f3cf2031fbc304d1835525409 (diff)
Adding unittests for build
- covers build.py - covers build_utils.py - moved build_utils out of build module, it wasn't possible to import build.py while build_utils was in a module Change-Id: I42f08a475d9ca219a62c421d4bdd2d1d3c49691a Signed-off-by: Dan Radez <dradez@redhat.com> (cherry picked from commit c876e9d261a7c3189cc8374c995014309c5b9881)
Diffstat (limited to 'apex/build.py')
-rw-r--r--apex/build.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/apex/build.py b/apex/build.py
index 2d0786a8..08f91abe 100644
--- a/apex/build.py
+++ b/apex/build.py
@@ -103,8 +103,8 @@ def unpack_cache(cache_dest, cache_dir=None):
except subprocess.CalledProcessError:
logging.warning("Cache unpack failed")
return
- logging.info("Cache unpacked, contents are: {}",
- os.listdir(cache_dest))
+ logging.info("Cache unpacked, contents are: {}".format(
+ os.listdir(cache_dest)))
def build(build_root, version, iso=False, rpms=False):
@@ -193,7 +193,7 @@ def prune_cache(cache_dir):
os.remove(cache_full_path)
cache_entries.pop(0)
cache_modified_flag = True
- except os.EX_OSERR:
+ except OSError:
logging.warning("Failed to remove cache file: {}".format(
cache_full_path))
break
@@ -207,7 +207,8 @@ def prune_cache(cache_dir):
with open(journal_file, 'w') as fh:
yaml.safe_dump(cache_entries, fh, default_flow_style=False)
-if __name__ == '__main__':
+
+def main():
parser = create_build_parser()
args = parser.parse_args(sys.argv[1:])
if args.debug:
@@ -247,3 +248,7 @@ if __name__ == '__main__':
build(apex_build_root, args.build_version, args.iso, args.rpms)
build_cache(cache_tmp_dir, args.cache_dir)
prune_cache(args.cache_dir)
+
+
+if __name__ == '__main__':
+ main()