Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagit/dagit_tests/test_debug_cli.py
Show All 9 Lines | |||||
@lambda_solid | @lambda_solid | ||||
def emit_one(): | def emit_one(): | ||||
return 1 | return 1 | ||||
@pipeline | @pipeline | ||||
def test_pipe(): | def pipe_test(): | ||||
emit_one() | emit_one() | ||||
emit_one() | emit_one() | ||||
def test_roundtrip(monkeypatch): | def test_roundtrip(monkeypatch): | ||||
runner = CliRunner() | runner = CliRunner() | ||||
with instance_for_test() as instance: | with instance_for_test() as instance: | ||||
run_result = execute_pipeline(test_pipe, instance=instance) | run_result = execute_pipeline(pipe_test, instance=instance) | ||||
assert run_result.success | assert run_result.success | ||||
file_path = path.join(instance.root_directory, ".temp.dump") | file_path = path.join(instance.root_directory, ".temp.dump") | ||||
export_result = runner.invoke(export_command, [run_result.run_id, file_path]) | export_result = runner.invoke(export_command, [run_result.run_id, file_path]) | ||||
assert "Exporting run_id" in export_result.output | assert "Exporting run_id" in export_result.output | ||||
assert file_path in export_result.output | assert file_path in export_result.output | ||||
# make dagit stop after launch | # make dagit stop after launch | ||||
monkeypatch.setattr(pywsgi.WSGIServer, "serve_forever", lambda _: None) | monkeypatch.setattr(pywsgi.WSGIServer, "serve_forever", lambda _: None) | ||||
debug_result = runner.invoke(dagit_debug_command, [file_path]) | debug_result = runner.invoke(dagit_debug_command, [file_path]) | ||||
assert file_path in debug_result.output | assert file_path in debug_result.output | ||||
assert "run_id: {}".format(run_result.run_id) in debug_result.output | assert "run_id: {}".format(run_result.run_id) in debug_result.output | ||||
assert "Serving on" in debug_result.output | assert "Serving on" in debug_result.output |