Skip to content

Commit

Permalink
ensure multiprocessing is not loaded if tests are skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
pedohorse committed Sep 18, 2024
1 parent 61fa39f commit 4dd76cb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/tests_net_messages/test_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os
import asyncio
import random
import string
import time
import threading
import multiprocessing
from unittest import IsolatedAsyncioTestCase, skip
from unittest import IsolatedAsyncioTestCase, skipIf
from lifeblood.logging import get_logger, set_default_loglevel
from lifeblood.nethelpers import get_localhost
from lifeblood.net_messages.address import AddressChain, DirectAddress
Expand All @@ -17,6 +15,11 @@

from typing import Callable, List, Type, Awaitable

SKIP_BENCHMARK = True
if not SKIP_BENCHMARK:
# just importing the module may be extremely slow on CI workers
import multiprocessing

set_default_loglevel('DEBUG')
logger = get_logger('message_test')

Expand Down Expand Up @@ -123,11 +126,11 @@ def get_message_count(self) -> int:


class TestBenchmarkSendReceive(IsolatedAsyncioTestCase):
@skip("no reason to benchmark on slow machines")
@skipIf(SKIP_BENCHMARK, "no reason to benchmark on slow machines")
async def test_threaded(self):
await self.helper_test(ThreadedFoo)

@skip("no reason to benchmark on slow machines")
@skipIf(SKIP_BENCHMARK, "no reason to benchmark on slow machines")
async def test_proc(self):
await self.helper_test(ProcessedFoo)

Expand Down

0 comments on commit 4dd76cb

Please sign in to comment.