2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

Remove dummy migration file (#8537)

This commit is contained in:
Oliver 2024-11-22 09:51:44 +11:00 committed by GitHub
parent 94089c94b7
commit e2e0ecc674
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -143,6 +143,13 @@ class InvenTreeTaskTests(TestCase):
os.environ['INVENTREE_AUTO_UPDATE'] = 'True' os.environ['INVENTREE_AUTO_UPDATE'] = 'True'
InvenTree.tasks.check_for_migrations() InvenTree.tasks.check_for_migrations()
# List all current migrations for the InvenTree app
migration_dir = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'migrations'
)
migration_files = os.listdir(migration_dir)
# Create migration # Create migration
self.assertEqual(len(InvenTree.tasks.get_migration_plan()), 0) self.assertEqual(len(InvenTree.tasks.get_migration_plan()), 0)
call_command('makemigrations', ['InvenTree', '--empty'], interactive=False) call_command('makemigrations', ['InvenTree', '--empty'], interactive=False)
@ -165,6 +172,19 @@ class InvenTreeTaskTests(TestCase):
except IndexError: # pragma: no cover except IndexError: # pragma: no cover
pass pass
# Let's remove the newly created migration file
for fn in os.listdir(migration_dir):
fn = os.path.join(migration_dir, fn)
if (
os.path.isfile(fn)
and fn not in migration_files
and 'auto' in fn
and fn.endswith('.py')
):
print('Removing dummy migration file:', fn)
os.remove(fn)
def test_failed_task_notification(self): def test_failed_task_notification(self):
"""Test that a failed task will generate a notification.""" """Test that a failed task will generate a notification."""
from common.models import NotificationEntry, NotificationMessage from common.models import NotificationEntry, NotificationMessage