matthewgilbert / blp

Pythonic interface for Bloomberg Open API
Apache License 2.0
112 stars 24 forks source link

Failures on Mypy Unitest Runner #23

Closed matthewgilbert closed 1 year ago

matthewgilbert commented 1 year ago

Issues with mypy unit tests

https://github.com/matthewgilbert/blp/actions/runs/4152070975/jobs/7182773532

============================= test session starts ==============================
platform linux -- Python 3.11.0, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/runner/work/blp/blp, configfile: pyproject.toml, testpaths: src
plugins: pydocstyle-2.3.2, flakes-4.0.5, mypy-0.[8](https://github.com/matthewgilbert/blp/actions/runs/4152070975/jobs/7182773532#step:5:9).0, isort-3.1.0, pycodestyle-2.3.1, black-0.3.12, mock-3.10.0, anyio-3.6.2
collected 115 items / 58 deselected / 57 selected

src/blp/__init__.py .....F                                               [ 10%]
src/blp/blp.py .F..F.ss....                                              [ 31%]
src/blp/test/__init__.py .....                                           [ 40%]
src/blp/test/test_blp.py ..................................              [100%]

=================================== FAILURES ===================================
_________________________________ test session _________________________________
mypy exited with status 1.
______________________________ Black format check ______________________________
--- /home/runner/work/blp/blp/src/blp/blp.py    2023-02-11 15:50:26.0[9](https://github.com/matthewgilbert/blp/actions/runs/4152070975/jobs/7182773532#step:5:10)2269 +0000
+++ /home/runner/work/blp/blp/src/blp/blp.py    2023-02-11 16:00:36.780815 +0000
@@ -36,15 +36,11 @@
 _AUTHORIZATION_FAILURE = blpapi.Name("AuthorizationFailure")
 _TOKEN_SUCCESS = blpapi.Name("TokenGenerationSuccess")
 _TOKEN_FAILURE = blpapi.Name("TokenGenerationFailure")
 _SESSION_TERMINATED = blpapi.Name("SessionTerminated")
 _SESSION_DOWN = blpapi.Name("SessionConnectionDown")
-_MARKET_DATA_EVENTS = [
-    blpapi.Name("MarketDataEvents"),
-    blpapi.Name("MarketBarStart"),
-    blpapi.Name("MarketBarUpdate")
-]
+_MARKET_DATA_EVENTS = [blpapi.Name("MarketDataEvents"), blpapi.Name("MarketBarStart"), blpapi.Name("MarketBarUpdate")]

 logger = logging.getLogger(__name__)

 class BlpSession:
@@ -481,11 +477,[10](https://github.com/matthewgilbert/blp/actions/runs/4152070975/jobs/7182773532#step:5:11) @@
             elem.setValue(value)
     return request

 class BlpQuery(BlpSession):
-
     _SERVICES = {
         "HistoricalDataRequest": "//blp/refdata",
         "ReferenceDataRequest": "//blp/refdata",
         "IntradayTickRequest": "//blp/refdata",
         "IntradayBarRequest": "//blp/refdata",
@@ -1036,[11](https://github.com/matthewgilbert/blp/actions/runs/4152070975/jobs/7182773532#step:5:12) +1031,10 @@
           log as a warning. This is ignored if ``processor_steps`` is not None.

     """

     def __init__(self, processor_steps: Optional[Sequence] = None, raise_security_errors: bool = True):
-
         if processor_steps is None and raise_security_errors:
             processor_steps = [
                 self._validate_event,
                 self._validate_response_type,
                 self._validate_response_error,

________________________________ src/blp/blp.py ________________________________
573: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int")  [assignment]
573: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
573: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
=============================== warnings summary ===============================
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:146
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:146
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:146
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:146
  /usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:146: PytestDeprecationWarning: <class 'pytest_black.BlackItem'> is not using a cooperative constructor and only takes {'parent', 'fspath'}.
  See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.
    warnings.warn(

../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:262
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:262
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:262
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:262
  /usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:262: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to BlackItem is deprecated. Please use the (path: pathlib.Path) argument instead.
  See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
    return cls._create(parent=parent, **kw)

../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:717
  /usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/_pytest/nodes.py:717: PytestWarning: BlackItem is an Item subclass and should not be a collector, however its bases File are collectors.
  Please split the Collectors and the Item into separate node types.
  Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html
  example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/
    warnings.warn(

../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/pytest_mypy.py:[12](https://github.com/matthewgilbert/blp/actions/runs/4152070975/jobs/7182773532#step:5:13)3
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/pytest_mypy.py:123
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/pytest_mypy.py:123
../../../../../usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/pytest_mypy.py:123
  /usr/share/miniconda/envs/blp-dev/lib/python3.11/site-packages/pytest_mypy.py:123: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to MypyFile is deprecated. Please use the (path: pathlib.Path) argument instead.
  See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
    return getattr(super(), 'from_parent', cls)(*args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================== mypy =====================================
Found 1 error in 1 file (checked 4 source files)
=========================== short test summary info ============================
FAILED src/blp/__init__.py::mypy-status
FAILED src/blp/blp.py::BLACK
FAILED src/blp/blp.py::mypy
===== 3 failed, 52 passed, 2 skipped, 58 deselected, [13](https://github.com/matthewgilbert/blp/actions/runs/4152070975/jobs/7182773532#step:5:14) warnings in 11.12s =====
Error: Process completed with exit code 1.