Posts

Showing posts with the label unit-testing

How to test airflow dag in unittest?

How to test airflow dag in unittest? I am trying to test a dag with more than one task in the test environment. I was able to test single task associated with the dag but I want to create several tasks in dag and kick of the first task. For testing one task in a dag I am using task1.run() task1.run() which is getting executed. But, the same is not working when I have many tasks one after another in downstream of a dag. from airflow import DAG from airflow.operators.bash_operator import BashOperator from datetime import datetime, timedelta default_args = { 'owner': 'airflow', 'depends_on_past': False, 'start_date': datetime(2015, 6, 1), 'email': ['airflow@example.com'], 'email_on_failure': False, 'email_on_retry': False, 'retries': 1, 'retry_delay': timedelta(minutes=5), # 'queue': 'bash_queue', # 'pool': 'backfill', # 'priority_weight': 10, # 'end_date': datet...

Pycharm - no tests were found?

Image
Pycharm - no tests were found? I've been getting a No tests were found error in Pycharm and I can't figure out why I'm getting it... this is what I have for my point_test.py : point_test.py import unittest import sys import os sys.path.insert(0, os.path.abspath('..')) from ..point import Point class TestPoint(unittest.TestCase): def setUp(self): pass def xyCheck(self,x,y): point = Point(x,y) self.assertEqual(x,point.x) self.assertEqual(y,point.y) and this point.py , what I'm trying to test: point.py import unittest from .utils import check_coincident, shift_point class Point(object): def __init__(self,x,y,mark={}): self.x = x self.y = y self.mark = mark def patched_coincident(self,point2): point1 = (self.x,self.y) return check_coincident(point1,point2) def patched_shift(self,x_shift,y_shift): point = (self.x,self.y) self.x,self,y = shift_point(point,x_shif...