Skip to content

Commit

Permalink
work around test framework issue on macOS
Browse files Browse the repository at this point in the history
add macOS to CI build

fixes #30
  • Loading branch information
belm0 committed Apr 15, 2022
1 parent 1e8f8e9 commit 9b59b66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, macos-latest]
backend: [asyncio, curio, trio, uvloop]
steps:
- uses: actions/checkout@v3
Expand Down
9 changes: 7 additions & 2 deletions src/purerpc/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import collections
import subprocess
import multiprocessing
import multiprocessing.connection
import tempfile
import shutil
import os
Expand All @@ -14,6 +13,7 @@
import time
import random
import string
from multiprocessing.connection import Connection

from tblib import pickling_support
pickling_support.install()
Expand All @@ -23,6 +23,11 @@
from async_generator import aclosing


# work around pickle issue on macOS
if sys.platform == 'darwin':
multiprocessing = multiprocessing.get_context('fork')


@contextlib.contextmanager
def compile_temp_proto(*relative_proto_paths):
modules = []
Expand Down Expand Up @@ -60,7 +65,7 @@ def compile_temp_proto(*relative_proto_paths):
_WrappedResult = collections.namedtuple("_WrappedResult", ("result", "exc_info"))


def _wrap_gen_in_process(conn: multiprocessing.connection.Connection):
def _wrap_gen_in_process(conn: Connection):
def decorator(gen):
@functools.wraps(gen)
def new_func(*args, **kwargs):
Expand Down

0 comments on commit 9b59b66

Please sign in to comment.