Skip to content

Commit

Permalink
Fix weird test behaviour
Browse files Browse the repository at this point in the history
The test was modifying a fixture, and this fixture is not in .gitignore.
The consequence is that if there were errors, the fixture was changed and developers would potentially commit an invalid fixture due to this.
This PR leverages the previous change introduced in #236 to use envvars for templating YML filepaths
  • Loading branch information
tatiana committed Oct 17, 2024
1 parent 540b33a commit 4dcc038
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 2 additions & 2 deletions tests/fixtures/dag_factory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ example_dag:
- task_1
operator: airflow.operators.bash_operator.BashOperator
example_dag2:
doc_md_file_path: {here}/fixtures/mydocfile.md
doc_md_file_path: $PWD/tests/fixtures/mydocfile.md
schedule_interval: None
tasks:
task_1:
Expand All @@ -53,7 +53,7 @@ example_dag3:
doc_md_python_arguments:
arg1: arg1
arg2: arg2
doc_md_python_callable_file: {here}/fixtures/doc_md_builder.py
doc_md_python_callable_file: $PWD/tests/fixtures/doc_md_builder.py
doc_md_python_callable_name: mydocmdbuilder
tasks:
task_1:
Expand Down
12 changes: 0 additions & 12 deletions tests/test_dagfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@
}


@pytest.fixture(autouse=True)
def build_path_for_doc_md():
with open(TEST_DAG_FACTORY, "r") as f:
oldText = f.read()
newText = oldText.replace("{here}", here)
with open(TEST_DAG_FACTORY, "w") as f:
f.write(newText)
yield
with open(TEST_DAG_FACTORY, "w") as f:
f.write(oldText)


def test_validate_config_filepath_valid():
dagfactory.DagFactory._validate_config_filepath(TEST_DAG_FACTORY)

Expand Down

0 comments on commit 4dcc038

Please sign in to comment.