Repository: oppia/oppia

Issue:
Backend test coverage check failing due to un-testable lines being counted as un-covered
In a [CI run](https://github.com/oppia/oppia/pull/13731/checks?check_run_id=3412652137) on #13731 the coverage check output from the backend tests looked like this:

```
Name                                                                             Stmts   Miss  Cover   Missing
--------------------------------------------------------------------------------------------------------------
android_validation_constants.py                                                     14      0   100%
constants.py                                                                        26      0   100%
core/controllers/access_validators.py                                               48      0   100%
core/controllers/acl_decorators.py                                                 958      0   100%
core/controllers/admin.py                                                          458      0   100%
core/controllers/android_e2e_config.py                                             128      0   100%
core/controllers/base.py                                                           363     93    74%   254, 259, 264, 269, 273, 276, 300, 303, 310, 315, 318-322, 331, 336, 342, 347, 359, 362, 376, 383, 391, 401, 426-428, 431-433, 446, 457, 465-495, 501-503, 508-516, 519-525, 541, 545, 548, 556-568, 577-581, 590-592, 604, 620-630, 645-647, 655-657, 663, 669, 675, 681, 691, 699, 706-710, 716, 723-734, 740-743, 748-750, 756-779, 793, 798, 802, 806, 813, 823-842
core/controllers/blog_admin.py                                                      62      0   100%
core/controllers/blog_dashboard.py                                                  98      0   100%
...
 --------------------------------------------------------------------------------------------------------------
TOTAL                                                                            37332     93    99%
Coverage failure: total of 100 is less than fail-under=100
```

At least some of the lines in `base.py` listed as missing coverage are not testable. For example, [line 254](https://github.com/U8NWXD/oppia/blob/2b889260243d5b03a1d68b2dd6992435ca7cd058/core/controllers/base.py#L254) is a comment.

In the [CI job](https://github.com/oppia/oppia/pull/13731/checks?check_run_id=3412445155) that actually ran the `base_test.py` tests (shard 1), the coverage was 100%:

```text
core/controllers/base.py                                                           362      0   100%
```


Discussion:
This may have happened because `base.py` changed between the shard and the coverage jobs running. Commit 33a634b89808618d96e8a1d5f0d6a92f8a33ba8d changed `base.py` and was added soon after this PR was opened. Since `base.py` changed, the line numbers reported by shard 1 would have not matched the code used by the coverage check because both jobs begin by merging from develop

Resolving patch:
diff --git a/scripts/linters/other_files_linter.py b/scripts/linters/other_files_linter.py
--- a/scripts/linters/other_files_linter.py
+++ b/scripts/linters/other_files_linter.py
@@ -48,6 +48,8 @@
 WORKFLOWS_DIR = os.path.join(os.getcwd(), '.github', 'workflows')
 WORKFLOW_FILENAME_REGEX = r'\.(yaml)|(yml)$'
 MERGE_STEP = {'uses': './.github/actions/merge'}
+WORKFLOWS_EXEMPT_FROM_MERGE_REQUIREMENT = (
+    'backend_tests.yml',)
 
 THIRD_PARTY_LIBS = [
     {
@@ -290,6 +292,7 @@ def check_github_workflows_use_merge_action(self):
             os.path.join(WORKFLOWS_DIR, filename)
             for filename in os.listdir(WORKFLOWS_DIR)
             if re.search(WORKFLOW_FILENAME_REGEX, filename)
+            if filename not in WORKFLOWS_EXEMPT_FROM_MERGE_REQUIREMENT
         }
         errors = []
         for workflow_path in workflow_paths:


Test patch:
diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml
--- a/.github/workflows/backend_tests.yml
+++ b/.github/workflows/backend_tests.yml
@@ -23,7 +23,6 @@ jobs:
         with:
           python-version: '3.7'
           architecture: 'x64'
-      - uses: ./.github/actions/merge
       - name: Install third party
         if: startsWith(github.head_ref, 'update-changelog-for-release') == false
         run: python -m scripts.install_third_party_libs
@@ -49,7 +48,6 @@ jobs:
         with:
           python-version: '3.7'
           architecture: 'x64'
-      - uses: ./.github/actions/merge
       # We need this so that we can check coverage of autogenerated code
       - name: Install third party
         if: startsWith(github.head_ref, 'update-changelog-for-release') == false