Skip to content

Commit

Permalink
Documentation build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ichorid committed Nov 24, 2021
1 parent 7a0e44d commit 9427d27
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ force_sort_within_sections=True
line_length=120
known_future_library=future
known_first_party=tribler_core,tribler_gui,tribler_common,run_tribler
known_third_party=pony,twisted,six,anydex,ipv8,libtorrent,lz4,PyQt5,zope,aiohttp,psutil,configobj,ipv8_service,asynctest,numpy,networkx,async_timeout,cherrypy,nose,validate,check_os,matplotlib,pyqtgraph,_socket,aiohttp_apispec,marshmallow,PIL,anyio,freezegun
known_third_party=pony,twisted,six,anydex,ipv8,libtorrent,lz4,PyQt5,zope,aiohttp,psutil,configobj,ipv8_service,asynctest,numpy,networkx,async_timeout,cherrypy,nose,validate,check_os,matplotlib,pyqtgraph,_socket,aiohttp_apispec,marshmallow,PIL,anyio,freezegun,yaml
8 changes: 4 additions & 4 deletions doc/extract_swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import aiohttp

import yaml

from tribler_core.components.restapi.rest.rest_manager import ApiKeyMiddleware, RESTManager, error_middleware
from tribler_core.config.tribler_config import TriblerConfig
from tribler_core.components.restapi.rest.root_endpoint import RootEndpoint

import yaml
from tribler_core.config.tribler_config import TriblerConfig


async def extract_swagger(destination_fn):
Expand All @@ -18,7 +18,7 @@ async def extract_swagger(destination_fn):
config.api.http_enabled = False
config.api.https_enabled = False

root_endpoint = RootEndpoint(config, middlewares=[ApiKeyMiddleware(config.api.key), error_middleware])
root_endpoint = RootEndpoint(middlewares=[ApiKeyMiddleware(config.api.key), error_middleware])
api_manager = RESTManager(config=config.api, root_endpoint=root_endpoint, state_dir=config.state_dir)
await api_manager.start()

Expand Down
3 changes: 2 additions & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ sphinx>=3.0.4 # not directly required, pinned by Snyk to avoid a vulnerability
sphinx_rtd_theme
sphinxcontrib-httpdomain==1.5.0
sphinxcontrib-openapi
sphinxcontrib.openapi
sphinxcontrib.openapi
configobj
10 changes: 5 additions & 5 deletions src/tribler-common/tribler_common/patch_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"""
import builtins
from typing import List

import mock
from unittest.mock import MagicMock, patch

__all__ = ['patch_import']


_builtins_import = builtins.__import__


Expand Down Expand Up @@ -41,11 +41,11 @@ def try_import(module_name, *args, **kwargs):
raise ImportError

if strict:
return mock.MagicMock(**mock_kwargs)
return MagicMock(**mock_kwargs)

try:
return _builtins_import(module_name, *args, **kwargs)
except ImportError:
return mock.MagicMock(**mock_kwargs)
return MagicMock(**mock_kwargs)

return mock.patch('builtins.__import__', try_import)
return patch('builtins.__import__', try_import)
1 change: 0 additions & 1 deletion src/tribler-common/tribler_common/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
mock~=4.0.3
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ async def test_get_dependencies():
# assert that in each scope dependencies are exist
assert list(get_dependencies(Scope.gui))
assert list(get_dependencies(Scope.core))
assert list(get_dependencies(Scope.common))


async def test_get_dependencies_wrong_scope():
Expand Down
3 changes: 1 addition & 2 deletions src/tribler-common/tribler_common/tests/test_patch_import.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from mock.mock import MagicMock
from unittest.mock import MagicMock

import pytest

from tribler_common.patch_import import patch_import


pytestmark = pytest.mark.asyncio


Expand Down

0 comments on commit 9427d27

Please sign in to comment.