You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ephraimbuddy (via GitHub)" <gi...@apache.org> on 2023/10/19 15:31:13 UTC

[PR] Add Code Coverage Helper Tool for Airflow [airflow]

ephraimbuddy opened a new pull request, #35061:
URL: https://github.com/apache/airflow/pull/35061

   - Facilitates local code coverage tracking for select areas.
   - Displays reports at https://localhost:280808/dev/coverage/index.html for the particular area for easy access.
   - Can also help in running tests in groups.
   
   Supported areas:
   - Core
   - REST API
   - CLI
   - WWW
   
   How to run the commands:
   - python scripts/coverage/test_core.py
   - python scripts/coverage/test_restapi.py
   - python scripts/coverage/test_cli.py
   - pyton scripts/coverage/test_www.py
   
   Note:
   - Tool can only be run within the Breeze environment.
   - A list of modules that are not fully covered is available in the command code
   - If a module achieves full coverage, the tool flags an error, so the module is removed from the list of not yet fully covered.
   - Also if a module at 100% coverage goes below, the tool flags it and ask that it should be improved.
   
   Currently, the coverage is not enforced even on the CI. It's currently just for anyone that want to work on some module's coverage
   
   


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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

   > (I can later add it BTW this way)
   
   Hi @potiuk, I think this option would be better because I'm having trouble with the breeze code. 


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
airflow/www/views.py:
##########
@@ -5827,6 +5828,33 @@ def add_user_permissions_to_dag(sender, template, context, **extra):
     context["dag"] = dag
 
 
+##############################################################################
+#                                                                            #
+#                          Development Views                                 #
+#                                                                            #
+##############################################################################
+
+
+class DevView(BaseView):
+    """View to show Airflow Dev Endpoints.
+
+    This view should only be accessible in development mode. For

Review Comment:
   One simple solution would be to add a config.



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
scripts/ci/docker-compose/devcontainer.env:
##########
@@ -18,6 +18,7 @@ HOME=
 AIRFLOW_CI_IMAGE="ghcr.io/apache/airflow/main/ci/python3.8:latest"
 ANSWER=
 AIRFLOW_ENABLE_AIP_44="true"
+AIRFLOW_ENV="development"

Review Comment:
   Hi @potiuk , I'm not sure where I can set this environment variable so that once breeze starts, it's set as "development"



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
TESTING.rst:
##########
@@ -1938,3 +1938,36 @@ On the screen you will see database queries for the given test.
 
 SQL query tracking does not work properly if your test runs subprocesses. Only queries from the main process
 are tracked.
+
+Code Coverage
+=============
+
+Airflow's CI process automatically uploads the code coverage report to codecov.io.
+
+Viewing the Coverage Report Online:
+-----------------------------------
+- For the most recent coverage report of the main branch, visit: https://codecov.io/gh/apache/airflow.
+
+Generating Local Coverage Reports:
+----------------------------------
+If you wish to obtain coverage reports for specific areas of the codebase on your local machine, follow these steps:
+
+   a. Initiate a breeze shell.

Review Comment:
   Fixed. Thanks!



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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

   For the api_connexion/ :
   ![Screenshot 2023-10-19 at 17 01 00](https://github.com/apache/airflow/assets/4122866/d58eac68-c84f-49b1-bfba-973f52d08f69)
   


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
scripts/ci/docker-compose/devcontainer.env:
##########
@@ -18,6 +18,7 @@ HOME=
 AIRFLOW_CI_IMAGE="ghcr.io/apache/airflow/main/ci/python3.8:latest"
 ANSWER=
 AIRFLOW_ENABLE_AIP_44="true"
+AIRFLOW_ENV="development"

Review Comment:
   Since the `--dev-mode` is not set by default in breeze, I think it won't be a good dev experience when running the coverage command in breeze. I feel it would be better to have the /dev views available once breeze is started. 



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
scripts/ci/docker-compose/devcontainer.env:
##########
@@ -18,6 +18,7 @@ HOME=
 AIRFLOW_CI_IMAGE="ghcr.io/apache/airflow/main/ci/python3.8:latest"
 ANSWER=
 AIRFLOW_ENABLE_AIP_44="true"
+AIRFLOW_ENV="development"

Review Comment:
   Sure, that will work as well.
   
   Then I think what you have now should be fine - looks like you set the AIRFLOW_ENV in all the places that are needed.



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
TESTING.rst:
##########
@@ -1938,3 +1938,36 @@ On the screen you will see database queries for the given test.
 
 SQL query tracking does not work properly if your test runs subprocesses. Only queries from the main process
 are tracked.
+
+Code Coverage
+=============
+
+Airflow's CI process automatically uploads the code coverage report to codecov.io.
+
+Viewing the Coverage Report Online:
+-----------------------------------
+For the most recent coverage report of the main branch, visit: https://codecov.io/gh/apache/airflow.
+
+Generating Local Coverage Reports:
+----------------------------------
+If you wish to obtain coverage reports for specific areas of the codebase on your local machine, follow these steps:
+
+a. Initiate a breeze shell.
+
+b. Execute one of the commands below based on the desired coverage area:
+
+   - **Core:** ``python scripts/cov/core_coverage.py``
+   - **REST API:** ``python scripts/cov/restapi_coverage.py``
+   - **CLI:** ``python scripts/cov/cli_coverage.py``
+   - **Webserver:** ``python scripts/cov/www_coverage.py``
+
+c. After execution, the coverage report will be available at: http://localhost:28000/dev/coverage/index.html.

Review Comment:
   ```suggestion
   c. After execution, the coverage report will be available at: http://localhost:28000/dev/coverage/index.html.
   
    .. note:
    
        In order to see the coverage report, you must start webserver first in breeze environment via `airflow webserver`. Once you enter `breeze`, you can start `tmux`  (terminal multiplexer) and split the terminal (by pressing `ctrl-B "` for example) to contiinue testing and run the webserver in one tetminal and run tests in the second one (you can switch between the terminals with `ctrl-B <arrow>`).
   ```



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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

   > Nice. I wonder if we have it added as `--with-coverage` flag for `breeze testing tests` maybe?
   
   I wanted to do it this way but the coverage report files get deleted at the end of the test. I will try again


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
airflow/www/views.py:
##########
@@ -5827,6 +5828,32 @@ def add_user_permissions_to_dag(sender, template, context, **extra):
     context["dag"] = dag
 
 
+##############################################################################
+#                                                                            #
+#                          Development Views                                 #
+#                                                                            #
+##############################################################################
+
+
+class DevView(BaseView):
+    """View to show Airflow Dev Endpoints.
+
+    This view should only be accessible in development mode. For
+    now, once there's a htmlcov, the coverage report will be shown
+    even in production.
+
+    TODO: Restrict this to only be accessible in development mode.
+    """

Review Comment:
   ```suggestion
       :meta private:
       """
   ```



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
airflow/www/views.py:
##########
@@ -5827,6 +5828,33 @@ def add_user_permissions_to_dag(sender, template, context, **extra):
     context["dag"] = dag
 
 
+##############################################################################
+#                                                                            #
+#                          Development Views                                 #
+#                                                                            #
+##############################################################################
+
+
+class DevView(BaseView):
+    """View to show Airflow Dev Endpoints.
+
+    This view should only be accessible in development mode. For

Review Comment:
   Is there anything to actually enforce this? I don’t see one.



##########
airflow/www/views.py:
##########
@@ -5827,6 +5828,33 @@ def add_user_permissions_to_dag(sender, template, context, **extra):
     context["dag"] = dag
 
 
+##############################################################################
+#                                                                            #
+#                          Development Views                                 #
+#                                                                            #
+##############################################################################
+
+
+class DevView(BaseView):
+    """View to show Airflow Dev Endpoints.
+
+    This view should only be accessible in development mode. For

Review Comment:
   Is there anything to actually enforce this? I don’t see one.



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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

   (I can later add it BTW this way). But also I think regardless - we should have it described somewhere (TESTING.rst seems like perfect place to do  it).


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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

   Nice. I wonder if we have it added as `--with-coverage` flag for `breeze testing tests`  maybe? 


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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

   Store them in /files


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
airflow/www/views.py:
##########
@@ -5827,6 +5828,33 @@ def add_user_permissions_to_dag(sender, template, context, **extra):
     context["dag"] = dag
 
 
+##############################################################################
+#                                                                            #
+#                          Development Views                                 #
+#                                                                            #
+##############################################################################
+
+
+class DevView(BaseView):
+    """View to show Airflow Dev Endpoints.
+
+    This view should only be accessible in development mode. For
+    now, once there's a htmlcov, the coverage report will be shown
+    even in production.
+
+    TODO: Restrict this to only be accessible in development mode.
+    :meta private:
+    """
+
+    route_base = "/dev"
+
+    @expose("/coverage/<path:path>")
+    def coverage(self, path):
+        self.template_folder = Path.cwd() / "htmlcov"
+        self.static_folder = Path.cwd() / "htmlcov"

Review Comment:
   ```suggestion
           self.template_folder = Path("htmlcov").resolve()
           self.static_folder = Path("htmlcov").resolve()
   ```



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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

   > > (I can later add it BTW this way)
   > 
   > Hi @potiuk, I think this option would be better because I'm having trouble with the breeze code.
   
   sure


-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
scripts/ci/docker-compose/devcontainer.env:
##########
@@ -18,6 +18,7 @@ HOME=
 AIRFLOW_CI_IMAGE="ghcr.io/apache/airflow/main/ci/python3.8:latest"
 ANSWER=
 AIRFLOW_ENABLE_AIP_44="true"
+AIRFLOW_ENV="development"

Review Comment:
   If you want to set it always:
   
   1) Dockerfile.ci (requires rebuilding the image) or
   2) entrypoint_ci.sh at the beginning
   
   But I do not think you want to hard-code it and alwaays have it in in  breeze. I thnk breeze airflow should be "as standard as possible" and iany dev mode should be set explicitly. 
   
   I think it would be better to only it in case you run `start-airflow` with `--dev-mode` (flag we already have). So maybe rather than inventing a new variable you should use the existing `DEV_MODE` variable for that. We already have it set to `true` when you pass `--dev-mode` either to `shell` command or `start-airflow`
   
   You can search and see where DEV_MODE is set alredy:
   
     * scripts/ci/docker-compose/_docker.env
     * scripts/ci/docker-compose/base.yml
   
   And the value ("true/false") is set in src/airflow_breeze/utils/docker_command_utils.py in the MAP where you map "dev_mode" attribute into DEV_MODE env variable.
   
   
   



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
scripts/ci/docker-compose/devcontainer.env:
##########
@@ -18,6 +18,7 @@ HOME=
 AIRFLOW_CI_IMAGE="ghcr.io/apache/airflow/main/ci/python3.8:latest"
 ANSWER=
 AIRFLOW_ENABLE_AIP_44="true"
+AIRFLOW_ENV="development"

Review Comment:
   Not sure what happened. I had been checking this and it wasn't working. Just pruned docker as breeze was complaining of space and as I tried again, the env is now there. Thanks!



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
scripts/ci/docker-compose/devcontainer.env:
##########
@@ -18,6 +18,7 @@ HOME=
 AIRFLOW_CI_IMAGE="ghcr.io/apache/airflow/main/ci/python3.8:latest"
 ANSWER=
 AIRFLOW_ENABLE_AIP_44="true"
+AIRFLOW_ENV="development"

Review Comment:
   If you want to set it always:
   
   1) Dockerfile.ci (requires rebuilding the image) or
   2) entrypoint_ci.sh at the beginning
   
   But I do not think you want to hard-code it and alwaays have it in in breeze. I think breeze `start-airflow` should be "as standard as possible" and any dev mode should be set explicitly. 
   
   I think it would be better to only set it in case you run `start-airflow` with `--dev-mode` (flag we already have). So maybe rather than inventing a new variable you should use the existing `DEV_MODE` variable for that. We already have it set to `true` when you pass `--dev-mode` either to `shell` command or `start-airflow`
   
   You can search and see where DEV_MODE is set alredy:
   
     * scripts/ci/docker-compose/_docker.env
     * scripts/ci/docker-compose/base.yml
   
   And the value ("true/false") is set in src/airflow_breeze/utils/docker_command_utils.py in the MAP where you map "dev_mode" attribute into DEV_MODE env variable.
   
   
   



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
TESTING.rst:
##########
@@ -1938,3 +1938,36 @@ On the screen you will see database queries for the given test.
 
 SQL query tracking does not work properly if your test runs subprocesses. Only queries from the main process
 are tracked.
+
+Code Coverage
+=============
+
+Airflow's CI process automatically uploads the code coverage report to codecov.io.
+
+Viewing the Coverage Report Online:
+-----------------------------------
+- For the most recent coverage report of the main branch, visit: https://codecov.io/gh/apache/airflow.
+
+Generating Local Coverage Reports:
+----------------------------------
+If you wish to obtain coverage reports for specific areas of the codebase on your local machine, follow these steps:
+
+   a. Initiate a breeze shell.

Review Comment:
   These lists don’t render correctly
   
   https://github.com/astronomer/airflow/blob/expose-cov-locally/TESTING.rst#viewing-the-coverage-report-online



##########
TESTING.rst:
##########
@@ -1938,3 +1938,36 @@ On the screen you will see database queries for the given test.
 
 SQL query tracking does not work properly if your test runs subprocesses. Only queries from the main process
 are tracked.
+
+Code Coverage
+=============
+
+Airflow's CI process automatically uploads the code coverage report to codecov.io.
+
+Viewing the Coverage Report Online:
+-----------------------------------
+- For the most recent coverage report of the main branch, visit: https://codecov.io/gh/apache/airflow.
+
+Generating Local Coverage Reports:
+----------------------------------
+If you wish to obtain coverage reports for specific areas of the codebase on your local machine, follow these steps:
+
+   a. Initiate a breeze shell.

Review Comment:
   These lists don’t render correctly
   
   https://github.com/astronomer/airflow/blob/expose-cov-locally/TESTING.rst#viewing-the-coverage-report-online



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
TESTING.rst:
##########
@@ -1938,3 +1938,36 @@ On the screen you will see database queries for the given test.
 
 SQL query tracking does not work properly if your test runs subprocesses. Only queries from the main process
 are tracked.
+
+Code Coverage
+=============
+
+Airflow's CI process automatically uploads the code coverage report to codecov.io.
+
+Viewing the Coverage Report Online:
+-----------------------------------
+For the most recent coverage report of the main branch, visit: https://codecov.io/gh/apache/airflow.
+
+Generating Local Coverage Reports:
+----------------------------------
+If you wish to obtain coverage reports for specific areas of the codebase on your local machine, follow these steps:
+
+a. Initiate a breeze shell.
+
+b. Execute one of the commands below based on the desired coverage area:
+
+   - **Core:** ``python scripts/cov/core_coverage.py``
+   - **REST API:** ``python scripts/cov/restapi_coverage.py``
+   - **CLI:** ``python scripts/cov/cli_coverage.py``
+   - **Webserver:** ``python scripts/cov/www_coverage.py``
+
+c. After execution, the coverage report will be available at: http://localhost:28000/dev/coverage/index.html.

Review Comment:
   ```suggestion
   c. After execution, the coverage report will be available at: http://localhost:28000/dev/coverage/index.html
   
    .. note:
    
        In order to see the coverage report, you must start webserver first in breeze environment via `airflow webserver`. Once you enter `breeze`, you can start `tmux`  (terminal multiplexer) and split the terminal (by pressing `ctrl-B "` for example) to contiinue testing and  run the webserver in one tetminal and run tests in the second one (you can switch between the terminals with `ctrl-B <arrow>`).
   ```



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
airflow/www/views.py:
##########
@@ -5827,6 +5828,33 @@ def add_user_permissions_to_dag(sender, template, context, **extra):
     context["dag"] = dag
 
 
+##############################################################################
+#                                                                            #
+#                          Development Views                                 #
+#                                                                            #
+##############################################################################
+
+
+class DevView(BaseView):
+    """View to show Airflow Dev Endpoints.
+
+    This view should only be accessible in development mode. For

Review Comment:
   There's no enforcement yet. It seems there's no concept of dev mode in airflow. I tried allowing access to localhost only using request.remote_addr but that didn't work



-- 
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


Re: [PR] Add Code Coverage Helper Tool for Airflow [airflow]

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


##########
airflow/www/views.py:
##########
@@ -5827,6 +5828,33 @@ def add_user_permissions_to_dag(sender, template, context, **extra):
     context["dag"] = dag
 
 
+##############################################################################
+#                                                                            #
+#                          Development Views                                 #
+#                                                                            #
+##############################################################################
+
+
+class DevView(BaseView):
+    """View to show Airflow Dev Endpoints.
+
+    This view should only be accessible in development mode. For

Review Comment:
   I decided to introduce `AIRFLOW_ENV` instead of adding a new config. When set to `development`, the view becomes accessible.



-- 
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