From 162437fbcda91ba2feec2308c35bb64bd611890c Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Wed, 27 Jul 2022 12:26:39 -0700 Subject: [PATCH] fix(ingest): use temp dir for file generated during test --- metadata-ingestion/tests/unit/test_pipeline.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata-ingestion/tests/unit/test_pipeline.py b/metadata-ingestion/tests/unit/test_pipeline.py index 6626435cb000c6..25a9b057f01555 100644 --- a/metadata-ingestion/tests/unit/test_pipeline.py +++ b/metadata-ingestion/tests/unit/test_pipeline.py @@ -109,7 +109,7 @@ def test_configure_with_rest_sink_initializes_graph( @freeze_time(FROZEN_TIME) @patch("datahub.ingestion.source.kafka.KafkaSource.get_workunits", autospec=True) - def test_configure_with_file_sink_does_not_init_graph(self, mock_source): + def test_configure_with_file_sink_does_not_init_graph(self, mock_source, tmp_path): pipeline = Pipeline.create( { "source": { @@ -119,7 +119,7 @@ def test_configure_with_file_sink_does_not_init_graph(self, mock_source): "sink": { "type": "file", "config": { - "filename": "test.json", + "filename": str(tmp_path / "test.json"), }, }, } @@ -127,7 +127,7 @@ def test_configure_with_file_sink_does_not_init_graph(self, mock_source): # assert that the default sink config is for a DatahubRestSink assert isinstance(pipeline.config.sink, DynamicTypedConfig) assert pipeline.config.sink.type == "file" - assert pipeline.config.sink.config == {"filename": "test.json"} + assert pipeline.config.sink.config == {"filename": str(tmp_path / "test.json")} assert pipeline.ctx.graph is None, "DataHubGraph should not be initialized" @freeze_time(FROZEN_TIME)