From e693fe1e416717fbd5527dabfbc3a16bbb8afcca Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 13 Feb 2022 04:55:39 +0100 Subject: [PATCH] fix migration coverage for build --- InvenTree/build/migrations/0013_auto_20200425_0507.py | 2 +- InvenTree/build/migrations/0029_auto_20210601_1525.py | 6 +++--- InvenTree/build/migrations/0032_auto_20211014_0632.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/InvenTree/build/migrations/0013_auto_20200425_0507.py b/InvenTree/build/migrations/0013_auto_20200425_0507.py index 9a9eba06e2..988bdcc9b8 100644 --- a/InvenTree/build/migrations/0013_auto_20200425_0507.py +++ b/InvenTree/build/migrations/0013_auto_20200425_0507.py @@ -11,7 +11,7 @@ def update_tree(apps, schema_editor): Build.objects.rebuild() -def nupdate_tree(apps, schema_editor): +def nupdate_tree(apps, schema_editor): # pragma: no cover pass diff --git a/InvenTree/build/migrations/0029_auto_20210601_1525.py b/InvenTree/build/migrations/0029_auto_20210601_1525.py index fa6bab6b26..12ec66960c 100644 --- a/InvenTree/build/migrations/0029_auto_20210601_1525.py +++ b/InvenTree/build/migrations/0029_auto_20210601_1525.py @@ -23,7 +23,7 @@ def assign_bom_items(apps, schema_editor): count_valid = 0 count_total = 0 - for build_item in BuildItem.objects.all(): + for build_item in BuildItem.objects.all(): # pragma: no cover # Try to find a BomItem which matches the BuildItem # Note: Before this migration, variant stock assignment was not allowed, @@ -45,11 +45,11 @@ def assign_bom_items(apps, schema_editor): except BomItem.DoesNotExist: pass - if count_total > 0: + if count_total > 0: # pragma: no cover logger.info(f"Assigned BomItem for {count_valid}/{count_total} entries") -def unassign_bom_items(apps, schema_editor): +def unassign_bom_items(apps, schema_editor): # pragma: no cover """ Reverse migration does not do anything. Function here to preserve ability to reverse migration diff --git a/InvenTree/build/migrations/0032_auto_20211014_0632.py b/InvenTree/build/migrations/0032_auto_20211014_0632.py index 3dac2b30c6..8842e25cc7 100644 --- a/InvenTree/build/migrations/0032_auto_20211014_0632.py +++ b/InvenTree/build/migrations/0032_auto_20211014_0632.py @@ -21,13 +21,13 @@ def build_refs(apps, schema_editor): if result and len(result.groups()) == 1: try: ref = int(result.groups()[0]) - except: + except: # pragma: no cover ref = 0 build.reference_int = ref build.save() -def unbuild_refs(apps, schema_editor): +def unbuild_refs(apps, schema_editor): # pragma: no cover """ Provided only for reverse migration compatibility """