Python moto.mock_emr() Examples
The following are 7
code examples of moto.mock_emr().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
moto
, or try the search function
.
Example #1
Source File: conftest.py From jungle with MIT License | 6 votes |
def emr(): """EMR mock service""" # FIXME: moto can only support us-east-1 when EMR module is used # https://github.com/spulec/moto/pull/456 # https://github.com/spulec/moto/pull/375 mock = mock_emr() mock.start() client = boto3.client('emr') clusters = [] for i in range(2): cluster = client.run_job_flow( Name='cluster-{:02d}'.format(i), Instances={ 'MasterInstanceType': 'c3.xlarge', 'SlaveInstanceType': 'c3.xlarge', 'InstanceCount': 3, 'Placement': {'AvailabilityZone': 'us-east-1'}, 'KeepJobFlowAliveWhenNoSteps': True, }, VisibleToAllUsers=True, ) clusters.append(cluster) yield {'clusters': clusters} mock.stop()
Example #2
Source File: test_moto.py From aws-data-wrangler with Apache License 2.0 | 5 votes |
def moto_emr(): with moto.mock_emr(): yield True
Example #3
Source File: test_poll.py From sparksteps with Apache License 2.0 | 5 votes |
def emr_client(aws_credentials): with mock_emr(): yield boto3.client('emr', region_name='us-east-1')
Example #4
Source File: test_poll.py From sparksteps with Apache License 2.0 | 5 votes |
def test_wait_for_step_complete(): """ Ensure polling.poll is called with expected arguments """ with patch('sparksteps.poll.poll') as mock_poll: mock_emr = MagicMock() jobflow_id = 'fake-jobflow-id' step_id = 'fake-step-id' wait_for_step_complete(mock_emr, jobflow_id, step_id, 1) mock_poll.assert_called_once_with( is_step_complete, args=(mock_emr, jobflow_id, step_id), step=1, poll_forever=True)
Example #5
Source File: test_emr.py From aws-auto-cleanup with GNU General Public License v3.0 | 5 votes |
def test_class(self): with moto.mock_emr(): whitelist = {} settings = { "general": {"dry_run": False}, "services": {"emr": {"clusters": {"clean": True, "ttl": -1}}}, } resource_tree = {"AWS": {}} test_class = emr_cleanup.EMRCleanup( logging, whitelist, settings, resource_tree, "ap-southeast-2" ) yield test_class
Example #6
Source File: test_emr.py From aws-auto-cleanup with GNU General Public License v3.0 | 5 votes |
def test_class(self): with moto.mock_emr(): whitelist = {} settings = { "general": {"dry_run": False}, "services": {"emr": {"clusters": {"clean": True, "ttl": 7}}}, } resource_tree = {"AWS": {}} test_class = emr_cleanup.EMRCleanup( logging, whitelist, settings, resource_tree, "ap-southeast-2" ) yield test_class
Example #7
Source File: test_emr.py From aws-auto-cleanup with GNU General Public License v3.0 | 5 votes |
def test_class(self): with moto.mock_emr(): whitelist = {} settings = { "general": {"dry_run": False}, "services": {"emr": {"clusters": {"clean": True, "ttl": -1}}}, } resource_tree = {"AWS": {}} test_class = emr_cleanup.EMRCleanup( logging, whitelist, settings, resource_tree, "ap-southeast-2" ) yield test_class