This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from main_module import main_func | |
def test_main_func_mocked(monkeypatch): | |
monkeypatch.setattr('main_module.service_func', lambda : 'mocked result') | |
assert main_func() == 'mocked result' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from main_module import main_func, main_func_2 | |
def test_main_func(monkeypatch): | |
monkeypatch.setattr('sub_module.service_func', lambda : 'mocked result') | |
assert main_func() == 'mocked result' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
def service_func(): | |
logging.info('From sub modules function') | |
return 'sub mod result' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sub_module import service_func | |
import logging | |
def main_func(): | |
logging.info('Calling sub modules function') | |
result = service_func() | |
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.python_operator import PythonOperator | |
def error_function(): | |
raise Exception('Something wrong') | |
t2 = PythonOperator( | |
task_id='failing_task', | |
python_callable=error_function, | |
email_on_failure=True, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.email_operator import EmailOperator | |
t1 = EmailOperator( | |
task_id="send_mail", | |
to='[email protected]', | |
subject='Test mail', | |
html_content='<p> You have got mail! <p>', | |
dag=dag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello, World!' |