Skip to content

Commit cfc8047

Browse files
authored
Force multiprocessing fork on macOS (#138)
* add py39 to tox file * force fork spawn on macos * add macos to matrix and update workflow file * remove unused imports * move start method declaration out of live server
1 parent f1a16f2 commit cfc8047

File tree

7 files changed

+31
-48
lines changed

7 files changed

+31
-48
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
11
name: build
22

33
on: [push, pull_request]
4-
54
jobs:
65
build:
7-
8-
runs-on: ubuntu-latest
9-
6+
runs-on: ${{ matrix.os }}
107
strategy:
118
fail-fast: false
129
matrix:
13-
tox_env: [
14-
"py35",
15-
"py36",
16-
"py37",
17-
"py38",
18-
"pre",
19-
"linting",
20-
]
21-
10+
python: ["3.5", "3.6", "3.7", "3.8", "3.9"]
11+
os: [ubuntu-latest, macos-latest]
2212
include:
23-
- tox_env: "py35"
24-
python: "3.5"
25-
- tox_env: "py36"
26-
python: "3.6"
27-
- tox_env: "py37"
28-
python: "3.7"
29-
- tox_env: "py38"
30-
python: "3.8"
31-
- tox_env: "pre"
32-
python: "3.7"
33-
- tox_env: "linting"
34-
python: "3.7"
35-
13+
- python: "3.5"
14+
tox_env: "py35"
15+
- python: "3.6"
16+
tox_env: "py36"
17+
- python: "3.7"
18+
tox_env: "py37"
19+
- python: "3.8"
20+
tox_env: "py38"
21+
- python: "3.9"
22+
tox_env: "py39"
23+
- python: "3.8"
24+
tox_env: "pre"
25+
- python: "3.8"
26+
tox_env: "linting"
3627
steps:
37-
- uses: actions/checkout@v1
28+
- uses: actions/checkout@v2
3829
- name: Set up Python
39-
uses: actions/setup-python@v1
30+
uses: actions/setup-python@v2
4031
with:
4132
python-version: ${{ matrix.python }}
4233
- name: Install tox
@@ -46,21 +37,16 @@ jobs:
4637
- name: Test
4738
run: |
4839
tox -e ${{ matrix.tox_env }}
49-
5040
deploy:
51-
5241
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
53-
5442
runs-on: ubuntu-latest
55-
5643
needs: build
57-
5844
steps:
59-
- uses: actions/checkout@v1
45+
- uses: actions/checkout@v2
6046
- name: Set up Python
61-
uses: actions/setup-python@v1
47+
uses: actions/setup-python@v2
6248
with:
63-
python-version: "3.7"
49+
python-version: "3.8"
6450
- name: Install wheel
6551
run: |
6652
python -m pip install --upgrade pip

pytest_flask/fixtures.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from ._internal import _determine_scope
99
from ._internal import _make_accept_header
1010
from ._internal import _rewrite_server_name
11-
from ._internal import deprecated
1211
from .live_server import LiveServer
1312

1413

pytest_flask/live_server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import logging
22
import multiprocessing
33
import os
4+
import platform
45
import signal
56
import socket
67
import time
78

89
import pytest
910

10-
from ._internal import deprecated
11+
12+
# force 'fork' on macOS
13+
if platform.system() == "Darwin":
14+
multiprocessing.set_start_method("fork")
1115

1216

1317
class LiveServer:

pytest_flask/plugin.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
:copyright: (c) by Vital Kudzelka
66
:license: MIT
77
"""
8-
import sys
9-
108
import pytest
11-
from flask import json
12-
from werkzeug.utils import cached_property
139

1410
from .fixtures import accept_any
1511
from .fixtures import accept_json

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
22
import os
33

4-
from setuptools import find_packages
54
from setuptools import setup
65

76

tests/test_json_response.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
from flask import Flask
32
from flask import url_for
43

54

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[tox]
22
envlist =
3-
py{35,36,37,38,linting}
3+
py{35,36,37,38,39,linting}
44

55
[pytest]
66
norecursedirs = .git .tox env coverage docs
77
pep8ignore =
88
docs/conf.py ALL
9-
pep8maxlinelength = 119
9+
pep8maxlinelength = 79
1010

1111
[testenv:dev]
1212
commands =
@@ -17,7 +17,7 @@ deps=
1717
-rrequirements/docs.txt
1818
pre-commit>=1.11.0
1919
tox
20-
basepython = python3.7
20+
basepython = python3.8
2121
usedevelop = True
2222

2323
[testenv]
@@ -54,7 +54,7 @@ commands = {[testenv]commands}
5454

5555
[testenv:linting]
5656
skip_install = True
57-
basepython = python3.7
57+
basepython = python3.8
5858
deps = pre-commit>=1.11.0
5959
commands = pre-commit run --all-files --show-diff-on-failure {posargs:}
6060

0 commit comments

Comments
 (0)