Repository: OpenAssetIO/OpenAssetIO (language: python)

Issue:
[Lint] `pylint` does not check tests due to fatal error
## What

`pylint` aborts with a fatal error when checking the `tests ` directory due to missing `__init__.py`.  This is reproducible locally.  

This does not fail the CI run. 

Linter errors in the main sources still get reported and will fail the CI run. 

Adding the missing `__init__.py` and re-running reveals many linter errors (mostly stuff we just forgot to explicitly ignore).

From [a recent CI run](https://github.com/OpenAssetIO/OpenAssetIO/actions/runs/4055787830/jobs/6979402597)
```
/opt/hostedtoolcache/Python/3.9.16/x64/bin/pylint --disable=fixme --ignore-paths=src/openassetio-python/tests/package/pluginSystem/resources/symlinkPath --rcfile=src/openassetio-python/pyproject.toml --output-format=json src/openassetio-python/package/openassetio src/openassetio-python/tests/package
[
    {
        "type": "fatal",
        "module": "package",
        "obj": "",
        "line": 1,
        "column": 0,
        "endLine": null,
        "endColumn": null,
        "path": "src/openassetio-python/tests/package/__init__.py",
        "symbol": "parse-error",
        "message": "error while code parsing: Unable to load file src/openassetio-python/tests/package/__init__.py:\n[Errno 2] No such file or directory: 'src/openassetio-python/tests/package/__init__.py'",
        "message-id": "F0010"
    }
]
```


Discussion / hints:
This may be something we need to fix in `fn-pylint-action`.
Possible workaround: https://stackoverflow.com/a/54963445/535103
Also, `fn-pylint-action` doesn't fail if pylint is not installed :roll_eyes: 

Fix patch:
diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
index f3c4f992e..d4475cc13 100644
--- a/.github/workflows/code-quality.yml
+++ b/.github/workflows/code-quality.yml
@@ -38,7 +38,7 @@ jobs:
             --recursive=y --disable=fixme
             --rcfile=src/openassetio-python/pyproject.toml
             src/openassetio-python/package/openassetio
-            src/openassetio-python/tests/package
+            src/openassetio-python/tests
 
   black:
     runs-on: ubuntu-latest
diff --git a/src/openassetio-python/package/openassetio/__init__.py b/src/openassetio-python/package/openassetio/__init__.py
index 31da79d08..97d4cd811 100644
--- a/src/openassetio-python/package/openassetio/__init__.py
+++ b/src/openassetio-python/package/openassetio/__init__.py
@@ -68,7 +68,7 @@
    https://openassetio.github.io/OpenAssetIO.
 """
 
-# pylint: disable=wrong-import-position,import-error
+# pylint: disable=wrong-import-position,import-error,no-name-in-module
 from ._openassetio import (
     constants,
     Context,


Test patch:
diff --git a/src/openassetio-python/tests/cmodule/test_PyRetainingSharedPtr.py b/src/openassetio-python/tests/cmodule/test_PyRetainingSharedPtr.py
index 57395dee7..eff625993 100644
--- a/src/openassetio-python/tests/cmodule/test_PyRetainingSharedPtr.py
+++ b/src/openassetio-python/tests/cmodule/test_PyRetainingSharedPtr.py
@@ -18,7 +18,6 @@
 shouldn't be included in the main sources.
 """
 
-# pylint: disable=no-self-use
 # pylint: disable=invalid-name,redefined-outer-name
 # pylint: disable=missing-class-docstring,missing-function-docstring
 import weakref
diff --git a/src/openassetio-python/tests/cmodule/test_errors.py b/src/openassetio-python/tests/cmodule/test_errors.py
index b32cfadd7..95de43366 100644
--- a/src/openassetio-python/tests/cmodule/test_errors.py
+++ b/src/openassetio-python/tests/cmodule/test_errors.py
@@ -17,11 +17,8 @@
 Tests of C++ binding utilities for exception types.
 """
 
-# pylint: disable=no-self-use
 # pylint: disable=invalid-name,redefined-outer-name
 # pylint: disable=missing-class-docstring,missing-function-docstring
-from unittest import mock
-
 import pytest
 
 from openassetio import _openassetio_test  # pylint: disable=no-name-in-module
diff --git a/src/openassetio-python/tests/test_cmake.py b/src/openassetio-python/tests/test_cmake.py
index 62b6b9de4..5e039bfd1 100644
--- a/src/openassetio-python/tests/test_cmake.py
+++ b/src/openassetio-python/tests/test_cmake.py
@@ -16,7 +16,7 @@
 """
 Test CMake installed package
 """
-# pylint: disable=missing-function-docstring
+# pylint: disable=missing-function-docstring,invalid-name
 import os
 
 import pytest
@@ -24,6 +24,8 @@
 
 try:
     from importlib import metadata
+
+    # pylint: disable=bare-except
 except:
     import importlib_metadata as metadata