Skip to content

Commit

Permalink
Merge pull request #6855 from drew2a/fix/6854
Browse files Browse the repository at this point in the history
Fix/6854
  • Loading branch information
drew2a authored Apr 11, 2022
2 parents 1f11f16 + 310db78 commit 32a12d8
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 149 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
python-version: ['3.8']
os: [macos-10.15, windows-latest, ubuntu-latest]
os: [macos-latest, windows-latest, ubuntu-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -34,6 +34,11 @@ jobs:
python -m pip install --upgrade pip
pip install -r ./requirements-test.txt
- name: Override PYTEST_TIMEOUT
if: matrix.os == 'macos-latest'
run: |
echo "PYTEST_TIMEOUT=300" >> $GITHUB_ENV
- name: Run Pytest
run: |
pytest ./src/tribler/core
Expand Down
11 changes: 1 addition & 10 deletions src/tribler/core/components/ipv8/tests/test_eva_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
from types import SimpleNamespace
from unittest.mock import Mock, patch

import pytest
from ipv8.community import Community
from ipv8.test.base import TestBase

import pytest

from tribler.core.components.ipv8.eva_protocol import (
Acknowledgement,
EVAProtocol,
Expand Down Expand Up @@ -133,7 +132,6 @@ async def test_zero_transfer(self):
assert len(self.overlay(0).sent_data[self.peer(1)]) == 0
assert len(self.overlay(1).received_data[self.peer(0)]) == 0

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_one_megabyte_transfer(self):
data_size = 1024 * 1024
data = os.urandom(1), os.urandom(data_size), random.randrange(0, 256)
Expand All @@ -145,7 +143,6 @@ async def test_one_megabyte_transfer(self):
assert len(self.overlay(1).most_recent_received_data[1]) == data_size
assert self.overlay(1).most_recent_received_data == data

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_termination_by_timeout(self):
self.overlay(0).eva_protocol.terminate_by_timeout_enabled = True
self.overlay(1).eva_protocol.terminate_by_timeout_enabled = True
Expand Down Expand Up @@ -241,7 +238,6 @@ async def test_size_limit(self):
assert not self.overlay(2).eva_protocol.outgoing
assert len(self.overlay(0).sent_data[self.peer(2)]) == 0

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_duplex(self):
count = 100
block_size = 10
Expand Down Expand Up @@ -269,7 +265,6 @@ async def test_duplex(self):
assert len(self.overlay(1).sent_data[self.peer(0)]) == 1
assert len(self.overlay(1).received_data[self.peer(0)]) == 1

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_multiply_send(self):
data_set_count = 10
data_size = 1024
Expand All @@ -283,7 +278,6 @@ async def test_multiply_send(self):
assert self.overlay(1).received_data[self.peer(0)] == data_list
assert not self.overlay(0).eva_protocol.scheduled

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_multiply_duplex(self):
data_set_count = 5

Expand Down Expand Up @@ -322,7 +316,6 @@ async def test_multiply_duplex(self):

assert data_sets_checked == 6

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_survive_when_multiply_packets_lost(self):
self.overlay(0).eva_protocol.retransmit_interval_in_sec = 0
self.overlay(1).eva_protocol.retransmit_interval_in_sec = 0
Expand Down Expand Up @@ -377,7 +370,6 @@ async def fake_on_data1(peer, payload):
assert len(self.overlay(1).received_data[self.peer(0)]) == data_set_count
assert self.overlay(1).received_data[self.peer(0)] == data

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_dynamically_changed_window_size(self):
window_size = 5

Expand Down Expand Up @@ -431,7 +423,6 @@ def fake_on_acknowledgement0(peer, payload):
assert isinstance(self.overlay(0).most_recent_received_exception, TransferException)
assert isinstance(self.overlay(1).most_recent_received_exception, SizeException)

@pytest.mark.timeout(PYTEST_TIMEOUT_IN_SEC)
async def test_wrong_message_order_and_wrong_nonce(self):
self.overlay(0).eva_protocol.retransmit_interval_in_sec = 0
self.overlay(1).eva_protocol.retransmit_interval_in_sec = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


@pytest.mark.asyncio
@pytest.mark.timeout(10)
async def test_download_torrent_from_url(tmp_path, file_server, download_manager):
# Setup file server to serve torrent file
shutil.copyfile(TORRENT_UBUNTU_FILE, tmp_path / "ubuntu.torrent")
Expand All @@ -17,15 +16,13 @@ async def test_download_torrent_from_url(tmp_path, file_server, download_manager


@pytest.mark.asyncio
@pytest.mark.timeout(10)
async def test_download_torrent_from_file(download_manager):
uri = path_to_url(TORRENT_UBUNTU_FILE)
d = await download_manager.start_download_from_uri(uri)
await d.wait_for_status(DLSTATUS_DOWNLOADING)


@pytest.mark.asyncio
@pytest.mark.timeout(10)
async def test_download_torrent_from_file_with_escaped_characters(download_manager, tmp_path):
destination = tmp_path / 'ubuntu%20%21 15.04.torrent'
shutil.copyfile(TORRENT_UBUNTU_FILE, destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


@pytest.mark.asyncio
@pytest.mark.timeout(20)
async def test_seeding(download_manager, video_seeder, video_tdef, tmp_path):
"""
Test whether a torrent is correctly seeded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ async def test_remote_query_big_response(self):
torrents1 = mds1.get_entries(**kwargs_dict)
self.assertEqual(len(torrents0), len(torrents1))

@pytest.mark.timeout(15)
async def test_remote_select_query_back_thumbs_and_descriptions(self):
"""
Test querying back preview thumbnail and description for previously unknown and updated channels.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import pytest
from asynctest import MagicMock

from ipv8.util import succeed

from pony.orm import db_session

import pytest

from tribler.core.components.gigachannel_manager.gigachannel_manager import GigaChannelManager
from tribler.core.components.libtorrent.download_manager.download_config import DownloadConfig
from tribler.core.components.libtorrent.download_manager.download_manager import DownloadManager
Expand Down Expand Up @@ -59,7 +56,6 @@ async def gigachannel_manager(metadata_store, download_manager):


@pytest.mark.asyncio
@pytest.mark.timeout(20)
async def test_channel_update_and_download(
channel_tdef, channel_seeder, metadata_store, download_manager, gigachannel_manager
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ def test_commit_channel_torrent(metadata_store):
assert not channel.commit_channel_torrent()


@pytest.mark.timeout(20)
@db_session
def test_recursive_commit_channel_torrent(metadata_store):
status_types = [NEW, UPDATED, TODELETE, COMMITTED]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ def pytest_addoption(parser):


def pytest_collection_modifyitems(config, items):
for item in items:
item.add_marker(pytest.mark.timeout(30))

if config.getoption("--tunneltests"):
# --tunneltests given in cli: do not skip GUI tests
return
Expand Down
Loading

0 comments on commit 32a12d8

Please sign in to comment.