Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Jan 25, 2022
1 parent 4094fb6 commit e26b28e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/tribler-core/tribler_core/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ async def shutdown(self):

def __enter__(self):
Session._stack.append(self)
return self

def __exit__(self, exc_type, exc_val, exc_tb):
assert Session._stack and Session._stack[-1] is self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from tribler_common.simpledefs import NTFY, STATEDIR_DB_DIR

import tribler_core.components.tag.tag_component as tc
from tribler_core.components.base import Component
from tribler_core.components.key.key_component import KeyComponent
from tribler_core.components.metadata_store.db.store import MetadataStore
from tribler_core.components.metadata_store.utils import generate_test_channels
from tribler_core.components.tag.rules.tag_rules_processor import TagRulesProcessor


Expand Down Expand Up @@ -48,9 +46,6 @@ async def run(self):
self.mds = metadata_store
self.session.notifier.add_observer(NTFY.TORRENT_METADATA_ADDED.value,
metadata_store.TorrentMetadata.add_ffa_from_dict)
if config.gui_test_mode:
tag_component = await self.require_component(tc.TagComponent)
generate_test_channels(metadata_store, tag_component.tags_db)

async def shutdown(self):
await super().shutdown()
Expand Down
4 changes: 4 additions & 0 deletions src/tribler-core/tribler_core/components/tag/tag_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from tribler_core.components.base import Component
from tribler_core.components.ipv8.ipv8_component import Ipv8Component
from tribler_core.components.key.key_component import KeyComponent
from tribler_core.components.metadata_store.utils import generate_test_channels
from tribler_core.components.tag.community.tag_community import TagCommunity
from tribler_core.components.tag.db.tag_db import TagDatabase
from tribler_core.components.tag.rules.tag_rules_processor import TagRulesProcessor
Expand Down Expand Up @@ -44,6 +45,9 @@ async def run(self):

self._ipv8_component.initialise_community_by_default(self.community)

if self.session.config.gui_test_mode:
generate_test_channels(mds_component.mds, self.tags_db)

async def shutdown(self):
await super().shutdown()
if self._ipv8_component and self.community:
Expand Down

0 comments on commit e26b28e

Please sign in to comment.