]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Fix the NormPathTest to accommodate for multi-process staging directories
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Sep 2019 21:45:18 +0000 (17:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Sep 2019 21:45:18 +0000 (17:45 -0400)
Change-Id: Ie1659e51f889bca5d1fe30eb52bc1d5a7aef097c

tests/test_script_production.py

index 802a256fbf9422b75ccfa04c415ea9e96b0c74ae..7188bba0bd69abe3cd5b4638f2e6ee6411d48d5d 100644 (file)
@@ -1270,22 +1270,23 @@ class NormPathTest(TestBase):
             return path.replace("/", ":NORM:")
 
         normpath = mock.Mock(side_effect=normpath)
+        normstaging = _get_staging_directory().replace("/", ":NORM:")
         with mock.patch("os.path.normpath", normpath):
             eq_(
                 script._version_locations,
                 (
                     ":NORM:home:NORM:classic:NORM:dev:NORM:alembic"
-                    ":NORM:scratch:NORM:scripts:NORM:versions",
+                    ":NORM:%s:NORM:scripts:NORM:versions" % normstaging,
                 ),
             )
 
             eq_(
                 script.versions,
-                ":NORM:home:NORM:classic:NORM:dev:NORM:alembic:NORM:scratch:"
-                "NORM:scripts:NORM:versions",
+                ":NORM:home:NORM:classic:NORM:dev:NORM:alembic:NORM:%s:"
+                "NORM:scripts:NORM:versions" % normstaging,
             )
 
-            eq_(script.dir, "scratch/scripts")
+            eq_(script.dir, "%s/scripts" % normstaging)
 
     def test_script_location_muliple(self):
         config = _multi_dir_testing_config()
@@ -1296,15 +1297,17 @@ class NormPathTest(TestBase):
             return path.replace("/", ":NORM:")
 
         normpath = mock.Mock(side_effect=normpath)
+        normstaging = _get_staging_directory().replace("/", ":NORM:")
+
         with mock.patch("os.path.normpath", normpath):
             eq_(
                 script._version_locations,
                 [
                     ":NORM:home:NORM:classic:NORM:dev:NORM:alembic"
-                    ":NORM:scratch:NORM:model1:NORM:",
+                    ":NORM:%s:NORM:model1:NORM:" % normstaging,
                     ":NORM:home:NORM:classic:NORM:dev:NORM:alembic"
-                    ":NORM:scratch:NORM:model2:NORM:",
+                    ":NORM:%s:NORM:model2:NORM:" % normstaging,
                     ":NORM:home:NORM:classic:NORM:dev:NORM:alembic"
-                    ":NORM:scratch:NORM:model3:NORM:",
+                    ":NORM:%s:NORM:model3:NORM:" % normstaging,
                 ],
             )