def test_port_collision(): def _raise_os_error(): raise OSError('Address already in use') with mock.patch('gevent.pywsgi.WSGIServer', new=_define_mock_server(_raise_os_error)): handle = ExecutionTargetHandle.for_repo_yaml( script_relative_path('./repository.yaml')) with pytest.raises(Exception) as exc_info: host_dagit_ui(handle=handle, host=None, port=2343) assert 'Another process ' in str(exc_info.value)
def test_unknown_error(): class AnException(Exception): pass def _raise_custom_error(): raise AnException('foobar') with mock.patch('gevent.pywsgi.WSGIServer', new=_define_mock_server(_raise_custom_error)): handle = ExecutionTargetHandle.for_repo_yaml( script_relative_path('./repository.yaml')) with pytest.raises(AnException): host_dagit_ui(handle=handle, host=None, port=2343)
def test_successful_host_dagit_ui(): with mock.patch('gevent.pywsgi.WSGIServer'): handle = ExecutionTargetHandle.for_repo_yaml( script_relative_path('./repository.yaml')) host_dagit_ui( log=False, log_dir=None, schedule_dir=None, handle=handle, use_sync=True, host=None, port=2343, )
def test_unknown_error(): class AnException(Exception): pass def _raise_custom_error(): raise AnException('foobar') with mock.patch( 'gevent.pywsgi.WSGIServer', new=_define_mock_server(_raise_custom_error) ), seven.TemporaryDirectory() as temp_dir: handle = ExecutionTargetHandle.for_repo_yaml( file_relative_path(__file__, './repository.yaml') ) with pytest.raises(AnException): host_dagit_ui(storage_fallback=temp_dir, handle=handle, host=None, port=2343)
def test_port_collision(): def _raise_os_error(): raise OSError('Address already in use') with mock.patch( 'gevent.pywsgi.WSGIServer', new=_define_mock_server(_raise_os_error) ), seven.TemporaryDirectory() as temp_dir: handle = ExecutionTargetHandle.for_repo_yaml( file_relative_path(__file__, './repository.yaml') ) with pytest.raises(Exception) as exc_info: host_dagit_ui( storage_fallback=temp_dir, handle=handle, host=None, port=2343, port_lookup=False ) assert 'another instance of dagit ' in str(exc_info.value)
def test_successful_host_dagit_ui(): with mock.patch('gevent.pywsgi.WSGIServer'): handle = ExecutionTargetHandle.for_repo_yaml( script_relative_path('./repository.yaml')) host_dagit_ui(handle=handle, host=None, port=2343)
def test_successful_host_dagit_ui(): with mock.patch('gevent.pywsgi.WSGIServer'), seven.TemporaryDirectory() as temp_dir: handle = ExecutionTargetHandle.for_repo_yaml( file_relative_path(__file__, './repository.yaml') ) host_dagit_ui(storage_fallback=temp_dir, handle=handle, host=None, port=2343)