Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dummy migration file #8537

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/backend/InvenTree/InvenTree/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ def test_task_check_for_migrations(self):
os.environ['INVENTREE_AUTO_UPDATE'] = 'True'
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
self.assertEqual(len(InvenTree.tasks.get_migration_plan()), 0)
call_command('makemigrations', ['InvenTree', '--empty'], interactive=False)
Expand All @@ -165,6 +172,19 @@ def test_task_check_for_migrations(self):
except IndexError: # pragma: no cover
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):
"""Test that a failed task will generate a notification."""
from common.models import NotificationEntry, NotificationMessage
Expand Down
Loading