From 4b9229b0f851d429f70d5ef7620a4302c493a89b Mon Sep 17 00:00:00 2001 From: Daniel Haaker Date: Sun, 21 Oct 2012 00:08:58 +0200 Subject: [PATCH] Fix bug with minute component in file_template and make sure it is tested correctly --- CHANGES | 3 +++ alembic/script.py | 2 +- tests/test_revision_create.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 9d551ecd..8e7ab6bf 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,9 @@ from operations.create_table() documentation. #81 +- [bug] Fixed the minute component in file_template + which returned the month part of the create date. + 0.4.0 ===== - [feature] Support for tables in alternate schemas diff --git a/alembic/script.py b/alembic/script.py index b411fb97..68d266ea 100644 --- a/alembic/script.py +++ b/alembic/script.py @@ -227,7 +227,7 @@ class ScriptDirectory(object): 'month': create_date.month, 'day': create_date.day, 'hour': create_date.hour, - 'minute': create_date.month, + 'minute': create_date.minute, 'second': create_date.second } ) diff --git a/tests/test_revision_create.py b/tests/test_revision_create.py index 78a628a2..fd9a7ed7 100644 --- a/tests/test_revision_create.py +++ b/tests/test_revision_create.py @@ -105,11 +105,11 @@ class ScriptNamingTest(unittest.TestCase): "%(day)s_%(hour)s_" "%(minute)s_%(second)s" ) - create_date = datetime.datetime(2012, 5, 25, 15, 8, 5) + create_date = datetime.datetime(2012, 7, 25, 15, 8, 5) eq_( script._rev_path("12345", "this is a message", create_date), "%s/versions/12345_this_is_a_" - "message_2012_5_25_15_5_5.py" % staging_directory + "message_2012_7_25_15_8_5.py" % staging_directory ) -- 2.47.2