Skip to content

Commit

Permalink
Add "no_parallel" pytest's mark
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Mar 3, 2022
1 parent 0dbd96f commit 6736035
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

# pylint: disable=protected-access


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_bandwidth_accounting_component(tribler_config):
components = [KeyComponent(), Ipv8Component(), BandwidthAccountingComponent()]
async with Session(tribler_config, components).start():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

# pylint: disable=protected-access


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_giga_channel_component(tribler_config):
tribler_config.ipv8.enabled = True
tribler_config.libtorrent.enabled = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_gigachannel_manager_component(tribler_config):
components = [Ipv8Component(), TagComponent(), SocksServersComponent(), KeyComponent(), MetadataStoreComponent(),
LibtorrentComponent(), GigachannelManagerComponent()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from tribler_core.components.ipv8.ipv8_component import Ipv8Component
from tribler_core.components.key.key_component import KeyComponent

pytestmark = pytest.mark.asyncio


# pylint: disable=protected-access
@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_ipv8_component(tribler_config):
async with Session(tribler_config, [KeyComponent(), Ipv8Component()]).start():
comp = Ipv8Component.instance()
Expand All @@ -19,6 +19,8 @@ async def test_ipv8_component(tribler_config):
assert not comp._peer_discovery_community


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_ipv8_component_dht_disabled(tribler_config):
tribler_config.ipv8.enabled = True
tribler_config.dht.enabled = True
Expand All @@ -27,6 +29,8 @@ async def test_ipv8_component_dht_disabled(tribler_config):
assert comp.dht_discovery_community


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_ipv8_component_discovery_community_enabled(tribler_config):
tribler_config.ipv8.enabled = True
tribler_config.gui_test_mode = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from tribler_core.components.libtorrent.libtorrent_component import LibtorrentComponent
from tribler_core.components.socks_servers.socks_servers_component import SocksServersComponent

pytestmark = pytest.mark.asyncio


# pylint: disable=protected-access

@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_libtorrent_component(tribler_config):
components = [KeyComponent(), SocksServersComponent(), LibtorrentComponent()]
async with Session(tribler_config, components).start():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

# pylint: disable=protected-access


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_metadata_store_component(tribler_config):
components = [TagComponent(), Ipv8Component(), KeyComponent(), MetadataStoreComponent()]
async with Session(tribler_config, components).start():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_payout_component(tribler_config):
components = [BandwidthAccountingComponent(), KeyComponent(), Ipv8Component(), PayoutComponent()]
async with Session(tribler_config, components).start():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_popularity_component(tribler_config):
components = [SocksServersComponent(), LibtorrentComponent(), TorrentCheckerComponent(), TagComponent(),
MetadataStoreComponent(), KeyComponent(), Ipv8Component(), PopularityComponent()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
from tribler_core.components.socks_servers.socks_servers_component import SocksServersComponent
from tribler_core.components.tag.tag_component import TagComponent

pytestmark = pytest.mark.asyncio


# pylint: disable=protected-access, not-callable, redefined-outer-name

@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_rest_component(tribler_config):
components = [KeyComponent(), RESTComponent(), Ipv8Component(), LibtorrentComponent(), ResourceMonitorComponent(),
BandwidthAccountingComponent(), GigaChannelComponent(), TagComponent(), SocksServersComponent(),
Expand Down Expand Up @@ -56,7 +55,7 @@ def rest_component():
component.root_endpoint = MagicMock()
return component


@pytest.mark.asyncio
async def test_maybe_add_check_args(rest_component, endpoint_cls):
# test that in case `*args` in `maybe_add` function contains `NoneComponent` instance
# no root_endpoint methods are called
Expand All @@ -67,6 +66,7 @@ async def test_maybe_add_check_args(rest_component, endpoint_cls):
rest_component.root_endpoint.assert_not_called()


@pytest.mark.asyncio
async def test_maybe_add_check_kwargs(rest_component, endpoint_cls):
# test that in case `**kwargs` in `maybe_add` function contains `NoneComponent` instance
# no root_endpoint methods are called
Expand All @@ -77,6 +77,7 @@ async def test_maybe_add_check_kwargs(rest_component, endpoint_cls):
rest_component.root_endpoint.assert_not_called()


@pytest.mark.asyncio
async def test_maybe_add(rest_component, endpoint_cls):
# test that in case there are no `NoneComponent` instances in `**kwargs` or `*args`
# root_endpoint methods are called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from tribler_core.components.base import Session
from tribler_core.components.socks_servers.socks_servers_component import SocksServersComponent

pytestmark = pytest.mark.asyncio


# pylint: disable=protected-access

@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_socks_servers_component(tribler_config):
components = [SocksServersComponent()]
async with Session(tribler_config, components).start():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_tag_component(tribler_config):
components = [MetadataStoreComponent(), KeyComponent(), Ipv8Component(), TagComponent()]
async with Session(tribler_config, components).start():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
from tribler_core.components.tag.tag_component import TagComponent
from tribler_core.components.torrent_checker.torrent_checker_component import TorrentCheckerComponent

pytestmark = pytest.mark.asyncio


# pylint: disable=protected-access


@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_torrent_checker_component(tribler_config):
components = [SocksServersComponent(), LibtorrentComponent(), KeyComponent(),
Ipv8Component(), TagComponent(), MetadataStoreComponent(), TorrentCheckerComponent()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
from tribler_core.components.key.key_component import KeyComponent
from tribler_core.components.tunnel.tunnel_component import TunnelsComponent

pytestmark = pytest.mark.asyncio


# pylint: disable=protected-access

@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_tunnels_component(tribler_config):
components = [Ipv8Component(), KeyComponent(), TunnelsComponent()]
async with Session(tribler_config, components).start():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
from tribler_core.components.socks_servers.socks_servers_component import SocksServersComponent
from tribler_core.components.watch_folder.watch_folder_component import WatchFolderComponent

pytestmark = pytest.mark.asyncio


# pylint: disable=protected-access

@pytest.mark.asyncio
@pytest.mark.no_parallel
async def test_watch_folder_component(tribler_config):
components = [KeyComponent(), SocksServersComponent(), LibtorrentComponent(), WatchFolderComponent()]
async with Session(tribler_config, components).start():
Expand Down

0 comments on commit 6736035

Please sign in to comment.