You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org> on 2023/02/05 12:07:26 UTC

[GitHub] [airflow] Abhishek-kumar-samsung opened a new pull request, #29377: Migrated operators tests to pytest

Abhishek-kumar-samsung opened a new pull request, #29377:
URL: https://github.com/apache/airflow/pull/29377

   Migrated some tests/operators to pytest
   
   related: https://github.com/apache/airflow/issues/29305


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1433496327

   @Taragolis done changes, as requested by you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Taragolis commented on a diff in pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #29377:
URL: https://github.com/apache/airflow/pull/29377#discussion_r1108415334


##########
tests/operators/test_datetime.py:
##########
@@ -113,121 +108,125 @@ def test_no_target_time(self):
                 dag=self.dag,
             )
 
+    @pytest.mark.parametrize(
+        "target_lower,target_upper",
+        [(target_lower, target_upper) for (target_lower, target_upper) in targets],
+    )
     @time_machine.travel("2020-07-07 10:54:05")
-    def test_branch_datetime_operator_falls_within_range(self):
+    def test_branch_datetime_operator_falls_within_range(self, target_lower, target_upper):
         """Check BranchDateTimeOperator branch operation"""
-        for target_lower, target_upper in self.targets:
-            with self.subTest(target_lower=target_lower, target_upper=target_upper):
-                self.branch_op.target_lower = target_lower
-                self.branch_op.target_upper = target_upper
-                self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
-
-                self._assert_task_ids_match_states(
-                    {
-                        "datetime_branch": State.SUCCESS,
-                        "branch_1": State.NONE,
-                        "branch_2": State.SKIPPED,
-                    }
-                )
+        self.branch_op.target_lower = target_lower
+        self.branch_op.target_upper = target_upper
+        self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
+
+        self._assert_task_ids_match_states(
+            {
+                "datetime_branch": State.SUCCESS,
+                "branch_1": State.NONE,
+                "branch_2": State.SKIPPED,
+            }
+        )
 
-    def test_branch_datetime_operator_falls_outside_range(self):
+    @pytest.mark.parametrize(
+        "target_lower,target_upper",
+        [(target_lower, target_upper) for (target_lower, target_upper) in targets],

Review Comment:
   ```suggestion
           targets,
   ```



##########
tests/operators/test_datetime.py:
##########
@@ -35,24 +34,23 @@
 INTERVAL = datetime.timedelta(hours=12)
 
 
-class TestBranchDateTimeOperator(unittest.TestCase):
+class TestBranchDateTimeOperator:
     @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
+    def setup_class(cls):
 
         with create_session() as session:
             session.query(DagRun).delete()
             session.query(TI).delete()
 
-        cls.targets = [
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(11, 0, 0), datetime.time(10, 0, 0)),
-        ]
+    targets = [
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),

Review Comment:
   There is two same parameters: `(datetime.time(10, 0, 0), datetime.time(11, 0, 0))`
   That a good question what we actually expected when we pass two `datetime.time` arguments and `target_lower >  target_upper` it could refers to the fact that BranchOperator work wrong with this case.
   
   Currently this test pass due to the fact that subtests do not reset DagRuns and other stuff and use only first one, it is not a case for `@pytest.mark.parametrize` and I guess initially this test failed



##########
tests/operators/test_datetime.py:
##########
@@ -113,121 +108,125 @@ def test_no_target_time(self):
                 dag=self.dag,
             )
 
+    @pytest.mark.parametrize(
+        "target_lower,target_upper",
+        [(target_lower, target_upper) for (target_lower, target_upper) in targets],

Review Comment:
   ```suggestion
           targets,
   ```



##########
tests/operators/test_datetime.py:
##########
@@ -113,121 +108,125 @@ def test_no_target_time(self):
                 dag=self.dag,
             )
 
+    @pytest.mark.parametrize(
+        "target_lower,target_upper",
+        [(target_lower, target_upper) for (target_lower, target_upper) in targets],
+    )
     @time_machine.travel("2020-07-07 10:54:05")
-    def test_branch_datetime_operator_falls_within_range(self):
+    def test_branch_datetime_operator_falls_within_range(self, target_lower, target_upper):
         """Check BranchDateTimeOperator branch operation"""
-        for target_lower, target_upper in self.targets:
-            with self.subTest(target_lower=target_lower, target_upper=target_upper):
-                self.branch_op.target_lower = target_lower
-                self.branch_op.target_upper = target_upper
-                self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
-
-                self._assert_task_ids_match_states(
-                    {
-                        "datetime_branch": State.SUCCESS,
-                        "branch_1": State.NONE,
-                        "branch_2": State.SKIPPED,
-                    }
-                )
+        self.branch_op.target_lower = target_lower
+        self.branch_op.target_upper = target_upper
+        self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
+
+        self._assert_task_ids_match_states(
+            {
+                "datetime_branch": State.SUCCESS,
+                "branch_1": State.NONE,
+                "branch_2": State.SKIPPED,
+            }
+        )
 
-    def test_branch_datetime_operator_falls_outside_range(self):
+    @pytest.mark.parametrize(
+        "target_lower,target_upper",
+        [(target_lower, target_upper) for (target_lower, target_upper) in targets],
+    )
+    def test_branch_datetime_operator_falls_outside_range(self, target_lower, target_upper):
         """Check BranchDateTimeOperator branch operation"""
         dates = [
             datetime.datetime(2020, 7, 7, 12, 0, 0, tzinfo=datetime.timezone.utc),
             datetime.datetime(2020, 6, 7, 12, 0, 0, tzinfo=datetime.timezone.utc),
         ]
 
-        for target_lower, target_upper in self.targets:
-            with self.subTest(target_lower=target_lower, target_upper=target_upper):
-                self.branch_op.target_lower = target_lower
-                self.branch_op.target_upper = target_upper
-
-                for date in dates:
-                    with time_machine.travel(date):
-                        self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
-
-                        self._assert_task_ids_match_states(
-                            {
-                                "datetime_branch": State.SUCCESS,
-                                "branch_1": State.SKIPPED,
-                                "branch_2": State.NONE,
-                            }
-                        )
-
-    @time_machine.travel("2020-07-07 10:54:05")
-    def test_branch_datetime_operator_upper_comparison_within_range(self):
-        """Check BranchDateTimeOperator branch operation"""
-        for _, target_upper in self.targets:
-            with self.subTest(target_upper=target_upper):
-                self.branch_op.target_upper = target_upper
-                self.branch_op.target_lower = None
+        self.branch_op.target_lower = target_lower
+        self.branch_op.target_upper = target_upper
 
+        for date in dates:
+            with time_machine.travel(date):
                 self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
 
                 self._assert_task_ids_match_states(
                     {
                         "datetime_branch": State.SUCCESS,
-                        "branch_1": State.NONE,
-                        "branch_2": State.SKIPPED,
+                        "branch_1": State.SKIPPED,
+                        "branch_2": State.NONE,
                     }
                 )
 
+    @pytest.mark.parametrize("target_upper", [target_upper for (_, target_upper) in targets])
     @time_machine.travel("2020-07-07 10:54:05")
-    def test_branch_datetime_operator_lower_comparison_within_range(self):
+    def test_branch_datetime_operator_upper_comparison_within_range(self, target_upper):
         """Check BranchDateTimeOperator branch operation"""
-        for target_lower, _ in self.targets:
-            with self.subTest(target_lower=target_lower):
-                self.branch_op.target_lower = target_lower
-                self.branch_op.target_upper = None
+        self.branch_op.target_upper = target_upper
+        self.branch_op.target_lower = None
 
-                self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
+        self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
 
-                self._assert_task_ids_match_states(
-                    {
-                        "datetime_branch": State.SUCCESS,
-                        "branch_1": State.NONE,
-                        "branch_2": State.SKIPPED,
-                    }
-                )
+        self._assert_task_ids_match_states(
+            {
+                "datetime_branch": State.SUCCESS,
+                "branch_1": State.NONE,
+                "branch_2": State.SKIPPED,
+            }
+        )
+
+    @pytest.mark.parametrize("target_lower", [target_lower for (target_lower, _) in targets])
+    @time_machine.travel("2020-07-07 10:54:05")
+    def test_branch_datetime_operator_lower_comparison_within_range(self, target_lower):
+        """Check BranchDateTimeOperator branch operation"""
+        self.branch_op.target_lower = target_lower
+        self.branch_op.target_upper = None
 
+        self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
+
+        self._assert_task_ids_match_states(
+            {
+                "datetime_branch": State.SUCCESS,
+                "branch_1": State.NONE,
+                "branch_2": State.SKIPPED,
+            }
+        )
+
+    @pytest.mark.parametrize("target_upper", [target_upper for (_, target_upper) in targets])
     @time_machine.travel("2020-07-07 12:00:00")
-    def test_branch_datetime_operator_upper_comparison_outside_range(self):
+    def test_branch_datetime_operator_upper_comparison_outside_range(self, target_upper):
         """Check BranchDateTimeOperator branch operation"""
-        for _, target_upper in self.targets:
-            with self.subTest(target_upper=target_upper):
-                self.branch_op.target_upper = target_upper
-                self.branch_op.target_lower = None
+        self.branch_op.target_upper = target_upper
+        self.branch_op.target_lower = None
 
-                self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
+        self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
 
-                self._assert_task_ids_match_states(
-                    {
-                        "datetime_branch": State.SUCCESS,
-                        "branch_1": State.SKIPPED,
-                        "branch_2": State.NONE,
-                    }
-                )
+        self._assert_task_ids_match_states(
+            {
+                "datetime_branch": State.SUCCESS,
+                "branch_1": State.SKIPPED,
+                "branch_2": State.NONE,
+            }
+        )
 
+    @pytest.mark.parametrize("target_lower", [target_lower for (target_lower, _) in targets])
     @time_machine.travel("2020-07-07 09:00:00")
-    def test_branch_datetime_operator_lower_comparison_outside_range(self):
+    def test_branch_datetime_operator_lower_comparison_outside_range(self, target_lower):
         """Check BranchDateTimeOperator branch operation"""
-        for target_lower, _ in self.targets:
-            with self.subTest(target_lower=target_lower):
-                self.branch_op.target_lower = target_lower
-                self.branch_op.target_upper = None
+        self.branch_op.target_lower = target_lower
+        self.branch_op.target_upper = None
 
-                self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
+        self.branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
 
-                self._assert_task_ids_match_states(
-                    {
-                        "datetime_branch": State.SUCCESS,
-                        "branch_1": State.SKIPPED,
-                        "branch_2": State.NONE,
-                    }
-                )
+        self._assert_task_ids_match_states(
+            {
+                "datetime_branch": State.SUCCESS,
+                "branch_1": State.SKIPPED,
+                "branch_2": State.NONE,
+            }
+        )
 
+    @pytest.mark.parametrize(
+        "target_lower,target_upper",
+        [(target_lower, target_upper) for (target_lower, target_upper) in targets],

Review Comment:
   ```suggestion
           targets,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1427025603

   @Taragolis migrated all tests/operators tests to pytest. Please check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1427025752

   @Taragolis @potiuk @eladkal please review and merge the PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1423875496

   In general yes - there was some problem in this case with available built images (something to solve separately). I rerun it and sometime after tests are all green we merge it (if you notice we did not - ping us).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1423875760

   In general yes - there was some problem in this case with available built images (something to solve separately). I rerun it and sometime after tests are all green we merge it (if you notice we did not - ping us).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Taragolis commented on a diff in pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #29377:
URL: https://github.com/apache/airflow/pull/29377#discussion_r1108625463


##########
tests/operators/test_datetime.py:
##########
@@ -35,24 +34,23 @@
 INTERVAL = datetime.timedelta(hours=12)
 
 
-class TestBranchDateTimeOperator(unittest.TestCase):
+class TestBranchDateTimeOperator:
     @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
+    def setup_class(cls):
 
         with create_session() as session:
             session.query(DagRun).delete()
             session.query(TI).delete()
 
-        cls.targets = [
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(11, 0, 0), datetime.time(10, 0, 0)),
-        ]
+    targets = [
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),

Review Comment:
   > I did wrong by changing target_lower?
   
   I would suggest just drop latest parameter, because it duplicated. I can't imagine how we could resolve `target_lower >  target_upper` in case of `datetime.time`.
   
   This operator originally have a broken test scenario and that is why it pass in `main` branch now 🤣 
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1423752290

   @Taragolis when an approved PR is finally merged by those who have write access?
   when all checks pass? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1423909197

   Okay thankyou.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1433584011

   > I will have a look later.
   > 
   > Seem like that all operators tests migrated to `pytest` if so, could you also change a PR name?
   
   Done


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on a diff in pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on code in PR #29377:
URL: https://github.com/apache/airflow/pull/29377#discussion_r1108563230


##########
tests/operators/test_datetime.py:
##########
@@ -35,24 +34,23 @@
 INTERVAL = datetime.timedelta(hours=12)
 
 
-class TestBranchDateTimeOperator(unittest.TestCase):
+class TestBranchDateTimeOperator:
     @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
+    def setup_class(cls):
 
         with create_session() as session:
             session.query(DagRun).delete()
             session.query(TI).delete()
 
-        cls.targets = [
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(11, 0, 0), datetime.time(10, 0, 0)),
-        ]
+    targets = [
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),

Review Comment:
   @Taragolis 
   so that was to check testcase when some wrong dates are passed?
   
   I did wrong by changing target_lower?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated operators tests to pytest

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1417646727

   @Taragolis migrated operators tests to pytest.
   
   Can you please review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1423895279

   @potiuk thankyou, i had one more PR related with the same issue.
   https://github.com/apache/airflow/pull/29373
   which was also approved, can you re run that also?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1423900197

   > i had one more PR related with the same issue. #29373 which was also approved, can you re run that also?
   
   rebase triggers new test run (I did it for the PR)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Abhishek-kumar-samsung commented on a diff in pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Abhishek-kumar-samsung (via GitHub)" <gi...@apache.org>.
Abhishek-kumar-samsung commented on code in PR #29377:
URL: https://github.com/apache/airflow/pull/29377#discussion_r1108556732


##########
tests/operators/test_datetime.py:
##########
@@ -35,24 +34,23 @@
 INTERVAL = datetime.timedelta(hours=12)
 
 
-class TestBranchDateTimeOperator(unittest.TestCase):
+class TestBranchDateTimeOperator:
     @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
+    def setup_class(cls):
 
         with create_session() as session:
             session.query(DagRun).delete()
             session.query(TI).delete()
 
-        cls.targets = [
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
-            (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
-            (datetime.time(11, 0, 0), datetime.time(10, 0, 0)),
-        ]
+    targets = [
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.datetime(2020, 7, 7, 10, 0, 0), datetime.time(11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.datetime(2020, 7, 7, 11, 0, 0)),
+        (datetime.time(10, 0, 0), datetime.time(11, 0, 0)),

Review Comment:
   Yes when target_lower>target_upper, then some error was coming with the same issue that target_lower>target_upper.
   
   I don't know why with subTests this error was not coming.
   
   So i thought it was some error as lower time should be smaller.
   
   Did i missed something?
   
   Earlier one was correct? or i did wrong on making target_lower greater?
   
   @Taragolis 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Taragolis commented on pull request #29377: Migrated email and generic transfer operators tests to `pytest`

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on PR #29377:
URL: https://github.com/apache/airflow/pull/29377#issuecomment-1433566575

   I will have a look later. 
   
   Seem like that all operators tests migrated to `pytest` if so, could you also change a PR name?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Taragolis merged pull request #29377: Migrated operators tests to `pytest`

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis merged PR #29377:
URL: https://github.com/apache/airflow/pull/29377


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org