From 63bbcd0df8e61ceaa734ec39ed9d5de6fff42308 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 19 Sep 2019 17:45:18 -0400 Subject: [PATCH] Fix the NormPathTest to accommodate for multi-process staging directories Change-Id: Ie1659e51f889bca5d1fe30eb52bc1d5a7aef097c --- tests/test_script_production.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/test_script_production.py b/tests/test_script_production.py index 802a256f..7188bba0 100644 --- a/tests/test_script_production.py +++ b/tests/test_script_production.py @@ -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, ], ) -- 2.47.2