This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new f0e2143  Check python version before starting triggerer (#18926)
f0e2143 is described below

commit f0e2143de688fbe2099d0e188e57fdbfaf6c12ed
Author: Jed Cunningham <[email protected]>
AuthorDate: Wed Oct 13 13:30:19 2021 -0600

    Check python version before starting triggerer (#18926)
---
 airflow/cli/cli_parser.py                    | 5 ++++-
 tests/cli/commands/test_triggerer_command.py | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/airflow/cli/cli_parser.py b/airflow/cli/cli_parser.py
index 7093116..85687a4 100644
--- a/airflow/cli/cli_parser.py
+++ b/airflow/cli/cli_parser.py
@@ -26,7 +26,7 @@ from argparse import Action, ArgumentError, 
RawTextHelpFormatter
 from functools import lru_cache
 from typing import Callable, Dict, Iterable, List, NamedTuple, Optional, Union
 
-from airflow import settings
+from airflow import PY37, settings
 from airflow.cli.commands.legacy_commands import check_legacy_command
 from airflow.configuration import conf
 from airflow.exceptions import AirflowException
@@ -73,6 +73,9 @@ class DefaultHelpParser(argparse.ArgumentParser):
                     "To do it, run: pip install 
'apache-airflow[cncf.kubernetes]'"
                 )
                 raise ArgumentError(action, message)
+        if action.dest == 'subcommand' and value == 'triggerer':
+            if not PY37:
+                raise ArgumentError(action, 'triggerer subcommand only works 
with Python 3.7+')
 
         if action.choices is not None and value not in action.choices:
             check_legacy_command(action, value)
diff --git a/tests/cli/commands/test_triggerer_command.py 
b/tests/cli/commands/test_triggerer_command.py
index 2c707ed..6b20e6f 100644
--- a/tests/cli/commands/test_triggerer_command.py
+++ b/tests/cli/commands/test_triggerer_command.py
@@ -18,6 +18,9 @@
 import unittest
 from unittest import mock
 
+import pytest
+
+from airflow import PY37
 from airflow.cli import cli_parser
 from airflow.cli.commands import triggerer_command
 
@@ -31,6 +34,7 @@ class TestTriggererCommand(unittest.TestCase):
     def setUpClass(cls):
         cls.parser = cli_parser.get_parser()
 
+    @pytest.mark.skipif(not PY37, reason="triggerer subcommand only works with 
Python 3.7+")
     @mock.patch("airflow.cli.commands.triggerer_command.TriggererJob")
     def test_capacity_argument(
         self,

Reply via email to