def test_check_upstream2():
    config = {
        "metadata": {
            "section_run": ["writer_config", "reader_config"]
        },
        "implementation_config": {
            "reader_config": {
                "read_data": {
                    "class": "CsvReader",
                    "filename": "test/tennis.csv",
                    "destinations":
                    ["recipe_csv_writer", "recipe_csv_writer2"],
                }
            },
            "writer_config": {
                "recipe_csv_writer": {
                    "class": "CsvWriter",
                    "key": "test_data",
                    "dir": "cache",
                    "filename": "unittest_similar_recipes.csv",
                },
                "recipe_csv_writer2": {
                    "class": "CsvWriter",
                    "key": "test_data",
                    "dir": "cache",
                    "filename": "unittest_similar_recipes.csv",
                },
            },
        },
    }
    configuration = Configuration(None,
                                  is_dict_config=True,
                                  dict_config=config)
    runner = DagRunner(configuration)
    with pytest.raises(Exception) as e:
        runner.check_for_upstream(
            ["recipe_csv_writer2", "read_data", "recipe_csv_writer"])
    assert "Upstream path found, from read_data to recipe_csv_writer2" in str(
        e.value)
def test_check_upstream():
    config = {
        "metadata": {
            "section_run": ["reader_config", "writer_config"]
        },
        "implementation_config": {
            "reader_config": {
                "read_data": {
                    "class": "CsvReader",
                    "filename": "test/tennis.csv",
                    "destinations":
                    ["recipe_csv_writer", "recipe_csv_writer2"],
                }
            },
            "writer_config": {
                "recipe_csv_writer": {
                    "class": "CsvWriter",
                    "key": "test_data",
                    "dir": "cache",
                    "filename": "unittest_similar_recipes.csv",
                },
                "recipe_csv_writer2": {
                    "class": "CsvWriter",
                    "key": "test_data",
                    "dir": "cache",
                    "filename": "unittest_similar_recipes.csv",
                },
            },
        },
    }
    configuration = Configuration(None,
                                  is_dict_config=True,
                                  dict_config=config)
    runner = DagRunner(configuration)
    assert (runner.check_for_upstream(
        ["read_data", "recipe_csv_writer", "recipe_csv_writer2"]) == False)