本文整理汇总了Python中common.utilities.inversion_of_control.Dependency.reload_from_different_file方法的典型用法代码示例。如果您正苦于以下问题:Python Dependency.reload_from_different_file方法的具体用法?Python Dependency.reload_from_different_file怎么用?Python Dependency.reload_from_different_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency.reload_from_different_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DeployGeoprocessingTests
# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import reload_from_different_file [as 别名]
class DeployGeoprocessingTests(unittest.TestCase):
def setUp(self):
# register mocks
register_mock_dependencies()
# get dependencies for verification
self.file_provider = Dependency("FileProvider").value
self.deployment_provider = Dependency("DeploymentProvider").value
self.cloud_provider = Dependency("CloudProviderNewEnvironment").value
self.email_provider = Dependency("EmailProvider").value
self.config = Dependency("Config").value
# get vars for tests
self.home = "/media/code/deploy"
def doCleanups(self):
# make sure correct config is loaded. When running from nose tests, sometimes the config stays loaded with the staging.b (which is replaced in a test below)
self._config = self.config.reload_from_different_file("config.yml")
# clear dependencies
dependencies.clear()
def test_default_variables(self):
"""
Verify that default deployment settings are correct
"""
deployer = GeoProcessingDeployer()
# make sure the default deployment setting are cloud/staging
self.assertEqual(deployer._worker_server, "CLOUD")
self.assertEqual(deployer._environment_config_file, "config.cloud.staging.a.yml")
# make sure the path is correct and does not end with a slash
self.assertEqual(deployer._root_directory, self.home)
self.assertFalse(deployer._root_directory.endswith("/"))
# test environmental variables
self.assertEqual(deployer._git_repository, "[email protected]:/mnt/nri_codeZ.git")
self.assertEqual(deployer._s3_config_file, self.home + "/.s3cfg")
self.assertEqual(deployer._loader_files_s3_directory, "s3://nri-repo/retail_loader_files/")
self.assertEqual(deployer._census_files_s3_directory, "s3://nri-repo/census_data/")
# verify the local folders
self.assertEqual(deployer._local_signal_directory, self.home + "/signal")
self.assertEqual(deployer._local_deploy_directory, self.home + "/signal/deploy")
self.assertEqual(deployer._local_code_directory, self.home + "/signal/deploy/code")
self.assertEqual(deployer._local_loader_files_directory, self.home + "/signal/deploy/loader_files")
self.assertEqual(deployer._local_census_data_directory, self.home + "/signal/deploy/census_data")
self.assertEqual(deployer._local_dot_git_directory, self.home + "/signal/deploy/code/.git/")
self.assertEqual(deployer._local_python_directory, self.home + "/signal/deploy/code/python")
self.assertEqual(deployer._local_geoprocessing_directory, self.home + "/signal/deploy/code/python/geoprocessing")
self.assertEqual(deployer._local_unit_tests_directory, self.home + "/signal/deploy/code/python/tests/unit_tests/geoprocessing_tests")
self.assertEqual(deployer._local_integration_tests_directory, self.home + "/signal/deploy/code/python/tests/integration_tests/geoprocessing_tests")
# verify build environment settings
self.assertEqual(deployer._build_db_script, "build/db/build_db.py")
self.assertEqual(deployer._update_config_script, "build/update_config_gis_servers.py")
self.assertEqual(deployer._create_cloud_script, "build/amazon_cloud_formation/create_geo_processing_amazon_worker_server.py")
self.assertEqual(deployer._cloud_template_gp_worker, self.home + "/signal/deploy/code/python/geoprocessing/build/amazon_cloud_formation/create_amazon_ubuntu_geo_processing_server.json")
self.assertEqual(deployer._cloud_template_honkin_GIS, self.home + "/signal/deploy/code/python/geoprocessing/build/amazon_cloud_formation/create_amazon_ubuntu_honkin_GIS.json")
self.assertEqual(deployer._create_cloud_script_output_gp_worker, "PublicDNS")
self.assertEqual(deployer._create_cloud_script_output_honkin_GIS, "PrivateDNS")
self.assertEqual(deployer._cloud_worker_name_gp_worker, "GeoProcessingWorker")
self.assertEqual(deployer._cloud_worker_name_honkin_GIS, "HonkinGISWorker")
self.assertEqual(deployer._honkin_GIS_sleep_seconds, 20)
# verify remote vars
self.assertEqual(deployer._remote_python_folder, "/signal/python")
self.assertEqual(deployer._remote_unit_tests_folder, "/signal/python/tests/unit_tests/geoprocessing_tests")
self.assertEqual(deployer._remote_integration_tests_folder, "/signal/python/tests/integration_tests/geoprocessing_tests")
self.assertEqual(deployer._remote_loader_files_remote_directory, "/signal/loader_files")
self.assertEqual(deployer._remote_census_files_remote_directory, "/signal/census_data")
self.assertEqual(deployer._remote_execute_geo_processing_python, "/signal/python/geoprocessing/build/geoprocessing_executor.py")
# verify loader file settings
self.assertEqual(deployer._loader_files_next_run_directory, self.home + "/signal/deploy/loader_files/next_run_a")
self.assertEqual(deployer._loader_files_temp_copy_directory, self.home + "/signal/deploy/loader_files/temp_copy_directory")
# verify mis settings
self.assertEqual(deployer._excel_file_format_regex, ".*\.xls[x]*$")
def test_proper_directories_are_created(self):
"""
Verify that the proper files are created
"""
deployer = GeoProcessingDeployer()
deployer._create_directory_structure()
self.assertIn(self.home + "/signal", self.file_provider.directories_created)
self.assertIn(self.home + "/signal/deploy", self.file_provider.directories_created)
self.assertIn(self.home + "/signal/deploy/loader_files", self.file_provider.directories_created)
self.assertIn(self.home + "/signal/deploy/census_data", self.file_provider.directories_created)
self.assertIn(self.home + "/signal/deploy/code", self.file_provider.directories_created)
def test_get_latest_from_git__no_repository(self):
"""
Verify that the repository gets cloned if there's no .git folder
"""
deployer = GeoProcessingDeployer()
#.........这里部分代码省略.........