Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unstable tests #6763

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ async def test_masterkey_component(tribler_config):
assert comp.primary_key


async def test_get_private_key_filename(tribler_config):
def test_get_private_key_filename(tribler_config):
private_key_file_name = KeyComponent.get_private_key_filename(tribler_config)
tribler_config.general.testnet = True
testnet_private_key_file_name = KeyComponent.get_private_key_filename(tribler_config)
assert private_key_file_name != testnet_private_key_file_name


@pytest.mark.asyncio
async def test_create(tmp_path):
def test_create(tmp_path):
private_key_path = tmp_path / 'private'
public_key_path = tmp_path / 'public'

Expand All @@ -32,8 +31,7 @@ async def test_create(tmp_path):
assert public_key_path.exists()


@pytest.mark.asyncio
async def test_create_no_public_key(tmp_path):
def test_create_no_public_key(tmp_path):
private_key_path = tmp_path / 'private'

assert not private_key_path.exists()
Expand All @@ -43,8 +41,7 @@ async def test_create_no_public_key(tmp_path):
assert private_key_path.exists()


@pytest.mark.asyncio
async def test_load(tmp_path):
def test_load(tmp_path):
private_key_path = tmp_path / 'private'
public_key_path = tmp_path / 'public'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def start(self):
interval=self.interval,
task=self.process_batch)

async def shutdown(self):
await self.shutdown_task_manager()

@db_session
def process_batch(self) -> int:
def query(_start, _end):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

# pylint: disable=redefined-outer-name, protected-access
@pytest.fixture
def tag_rules_processor():
return TagRulesProcessor(notifier=MagicMock(), db=MagicMock(), mds=MagicMock(), batch_size=TEST_BATCH_SIZE,
interval=TEST_INTERVAL)
async def tag_rules_processor():
processor = TagRulesProcessor(notifier=MagicMock(), db=MagicMock(), mds=MagicMock(), batch_size=TEST_BATCH_SIZE,
interval=TEST_INTERVAL)
yield processor
await processor.shutdown()


def test_constructor(tag_rules_processor: TagRulesProcessor):
Expand Down