Skip to content

Commit

Permalink
Merge pull request #7518 from Tribler/fix/win_pytests
Browse files Browse the repository at this point in the history
Fix pytest for win
  • Loading branch information
drew2a authored Jun 28, 2023
2 parents 4dfa004 + 6f8b4db commit 9fa0386
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/vars/pytest.env
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PYTEST_ARGUMENTS='--randomly-seed=1 --disable-warnings --reruns 1 --reruns-delay 1 --verbose --durations=3'

PYTEST_CORE_ARGUMENTS='./src/tribler/core ${PYTEST_ARGUMENTS}'
PYTEST_CORE_ARGUMENTS_WIN='${PYTEST_CORE_ARGUMENTS}'
PYTEST_CORE_ARGUMENTS_WIN='${PYTEST_CORE_ARGUMENTS} --no-looptime'
PYTEST_CORE_ARGUMENTS_LINUX='${PYTEST_CORE_ARGUMENTS} --looptime'
PYTEST_CORE_ARGUMENTS_MAC='${PYTEST_CORE_ARGUMENTS} --looptime'

PYTEST_TUNNELS_ARGUMENTS='./src/tribler/core/components/tunnel/tests/test_full_session --tunneltests ${PYTEST_ARGUMENTS}'
PYTEST_TUNNELS_ARGUMENTS_WIN='${PYTEST_TUNNELS_ARGUMENTS}'
PYTEST_TUNNELS_ARGUMENTS_WIN='${PYTEST_TUNNELS_ARGUMENTS} --no-looptime'
PYTEST_TUNNELS_ARGUMENTS_LINUX='${PYTEST_TUNNELS_ARGUMENTS} --looptime'
PYTEST_TUNNELS_ARGUMENTS_MAC='${PYTEST_TUNNELS_ARGUMENTS} --looptime'

PYTEST_GUI_ARGUMENTS='./src/tribler/gui --guitests ${PYTEST_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS_WIN='${PYTEST_GUI_ARGUMENTS}'
PYTEST_GUI_ARGUMENTS_WIN='${PYTEST_GUI_ARGUMENTS} --no-looptime'
PYTEST_GUI_ARGUMENTS_LINUX='${PYTEST_GUI_ARGUMENTS} --looptime'
PYTEST_GUI_ARGUMENTS_MAC='${PYTEST_GUI_ARGUMENTS} --looptime'
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ async def transfer():
await protocol_task_group.wait()


@pytest.mark.looptime(start=42)
def test_update(transfer: Transfer):
# In this test we ensure that `transfer.update` method sets `time.time` value
# to `transfer.updated` property.
transfer.loop.time = Mock(return_value=42)

transfer.update()

assert transfer.updated == 42
Expand Down Expand Up @@ -252,9 +253,9 @@ async def test_format_attempt(transfer: Transfer):
assert transfer._format_attempt(remains=0, maximum=3) == '3/3'


@pytest.mark.looptime(start=10)
async def test_remaining(transfer: Transfer):
# Imagine that now time is `10` and transfer has been updated in `0`
transfer.loop.time = Mock(return_value=10)
transfer.updated = 0

assert transfer._remaining(5) == -5
Expand Down

0 comments on commit 9fa0386

Please sign in to comment.