diff options
Diffstat (limited to 'tests/test_revision_create.py')
-rw-r--r-- | tests/test_revision_create.py | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/tests/test_revision_create.py b/tests/test_revision_create.py index 5bf12cf..cbe2a6e 100644 --- a/tests/test_revision_create.py +++ b/tests/test_revision_create.py @@ -10,7 +10,9 @@ import datetime env, abc, def_ = None, None, None + class GeneralOrderedTests(unittest.TestCase): + def test_001_environment(self): assert_set = set(['env.py', 'script.py.mako', 'README']) eq_( @@ -76,28 +78,26 @@ class GeneralOrderedTests(unittest.TestCase): def test_008_long_name(self): rid = util.rev_id() env.generate_revision(rid, - "this is a really long name with " - "lots of characters and also " - "I'd like it to\nhave\nnewlines") + "this is a really long name with " + "lots of characters and also " + "I'd like it to\nhave\nnewlines") assert os.access( os.path.join(env.dir, 'versions', - '%s_this_is_a_really_long_name_with_lots_of_.py' % rid), - os.F_OK) - + '%s_this_is_a_really_long_name_with_lots_of_.py' % rid), + os.F_OK) def test_009_long_name_configurable(self): env.truncate_slug_length = 60 rid = util.rev_id() env.generate_revision(rid, - "this is a really long name with " - "lots of characters and also " - "I'd like it to\nhave\nnewlines") + "this is a really long name with " + "lots of characters and also " + "I'd like it to\nhave\nnewlines") assert os.access( os.path.join(env.dir, 'versions', - '%s_this_is_a_really_long_name_with_lots_' - 'of_characters_and_also_.py' % rid), - os.F_OK) - + '%s_this_is_a_really_long_name_with_lots_' + 'of_characters_and_also_.py' % rid), + os.F_OK) @classmethod def setup_class(cls): @@ -108,7 +108,9 @@ class GeneralOrderedTests(unittest.TestCase): def teardown_class(cls): clear_staging_env() + class ScriptNamingTest(unittest.TestCase): + @classmethod def setup_class(cls): _testing_config() @@ -119,12 +121,12 @@ class ScriptNamingTest(unittest.TestCase): def test_args(self): script = ScriptDirectory( - staging_directory, - file_template="%(rev)s_%(slug)s_" - "%(year)s_%(month)s_" - "%(day)s_%(hour)s_" - "%(minute)s_%(second)s" - ) + staging_directory, + file_template="%(rev)s_%(slug)s_" + "%(year)s_%(month)s_" + "%(day)s_%(hour)s_" + "%(minute)s_%(second)s" + ) create_date = datetime.datetime(2012, 7, 25, 15, 8, 5) eq_( script._rev_path("12345", "this is a message", create_date), @@ -134,6 +136,7 @@ class ScriptNamingTest(unittest.TestCase): class TemplateArgsTest(unittest.TestCase): + def setUp(self): staging_env() self.cfg = _no_sql_testing_config( @@ -153,7 +156,7 @@ class TemplateArgsTest(unittest.TestCase): template_args=template_args ) env.configure(dialect_name="sqlite", - template_args={"y": "y2", "q": "q1"}) + template_args={"y": "y2", "q": "q1"}) eq_( template_args, {"x": "x1", "y": "y2", "z": "z1", "q": "q1"} @@ -206,4 +209,3 @@ down_revision = ${repr(down_revision)} with open(rev.path) as f: text = f.read() assert "somearg: somevalue" in text - |