From b8cf33b2bde998ff38196a8bc1259640957bdd80 Mon Sep 17 00:00:00 2001 From: northernSage Date: Thu, 3 Jun 2021 21:42:22 -0300 Subject: [PATCH 1/5] add py39 to tox file --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 3a572f0..b706b9b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,12 @@ [tox] envlist = - py{35,36,37,38,linting} + py{35,36,37,38,39,linting} [pytest] norecursedirs = .git .tox env coverage docs pep8ignore = docs/conf.py ALL -pep8maxlinelength = 119 +pep8maxlinelength = 79 [testenv:dev] commands = @@ -17,7 +17,7 @@ deps= -rrequirements/docs.txt pre-commit>=1.11.0 tox -basepython = python3.7 +basepython = python3.8 usedevelop = True [testenv] @@ -54,7 +54,7 @@ commands = {[testenv]commands} [testenv:linting] skip_install = True -basepython = python3.7 +basepython = python3.8 deps = pre-commit>=1.11.0 commands = pre-commit run --all-files --show-diff-on-failure {posargs:} From a6930d76b75f5332a404c2db5cf6e06694630984 Mon Sep 17 00:00:00 2001 From: northernSage Date: Thu, 3 Jun 2021 21:43:26 -0300 Subject: [PATCH 2/5] force fork spawn on macos --- pytest_flask/live_server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pytest_flask/live_server.py b/pytest_flask/live_server.py index 23a0371..de74e17 100644 --- a/pytest_flask/live_server.py +++ b/pytest_flask/live_server.py @@ -1,6 +1,7 @@ import logging import multiprocessing import os +import platform import signal import socket import time @@ -29,6 +30,10 @@ def __init__(self, app, host, port, wait, clean_stop=False): self.clean_stop = clean_stop self._process = None + # force fork on macOS + if platform.system() == "Darwin": + multiprocessing.set_start_method("fork") + def start(self): """Start application in a separate process.""" From 6db2b6f3bf7d440527278a3b174de4ed021ba874 Mon Sep 17 00:00:00 2001 From: northernSage Date: Thu, 3 Jun 2021 21:43:54 -0300 Subject: [PATCH 3/5] add macos to matrix and update workflow file --- .github/workflows/main.yml | 58 +++++++++++++++----------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58e331f..3a0a5e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,42 +1,33 @@ name: build on: [push, pull_request] - jobs: build: - - runs-on: ubuntu-latest - + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - tox_env: [ - "py35", - "py36", - "py37", - "py38", - "pre", - "linting", - ] - + python: ["3.5", "3.6", "3.7", "3.8", "3.9"] + os: [ubuntu-latest, macos-latest] include: - - tox_env: "py35" - python: "3.5" - - tox_env: "py36" - python: "3.6" - - tox_env: "py37" - python: "3.7" - - tox_env: "py38" - python: "3.8" - - tox_env: "pre" - python: "3.7" - - tox_env: "linting" - python: "3.7" - + - python: "3.5" + tox_env: "py35" + - python: "3.6" + tox_env: "py36" + - python: "3.7" + tox_env: "py37" + - python: "3.8" + tox_env: "py38" + - python: "3.9" + tox_env: "py39" + - python: "3.8" + tox_env: "pre" + - python: "3.8" + tox_env: "linting" steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - name: Install tox @@ -46,21 +37,16 @@ jobs: - name: Test run: | tox -e ${{ matrix.tox_env }} - deploy: - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - runs-on: ubuntu-latest - needs: build - steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: - python-version: "3.7" + python-version: "3.8" - name: Install wheel run: | python -m pip install --upgrade pip From 264b38047b03114faca6dc64c56ff53e7452f59b Mon Sep 17 00:00:00 2001 From: northernSage Date: Thu, 3 Jun 2021 21:58:00 -0300 Subject: [PATCH 4/5] remove unused imports --- pytest_flask/fixtures.py | 1 - pytest_flask/live_server.py | 2 -- pytest_flask/plugin.py | 4 ---- setup.py | 1 - tests/test_json_response.py | 1 - 5 files changed, 9 deletions(-) diff --git a/pytest_flask/fixtures.py b/pytest_flask/fixtures.py index eb25861..4b66b62 100755 --- a/pytest_flask/fixtures.py +++ b/pytest_flask/fixtures.py @@ -8,7 +8,6 @@ from ._internal import _determine_scope from ._internal import _make_accept_header from ._internal import _rewrite_server_name -from ._internal import deprecated from .live_server import LiveServer diff --git a/pytest_flask/live_server.py b/pytest_flask/live_server.py index de74e17..0cd5600 100644 --- a/pytest_flask/live_server.py +++ b/pytest_flask/live_server.py @@ -8,8 +8,6 @@ import pytest -from ._internal import deprecated - class LiveServer: """The helper class used to manage a live server. Handles creation and diff --git a/pytest_flask/plugin.py b/pytest_flask/plugin.py index bb4bf59..07b1df8 100755 --- a/pytest_flask/plugin.py +++ b/pytest_flask/plugin.py @@ -5,11 +5,7 @@ :copyright: (c) by Vital Kudzelka :license: MIT """ -import sys - import pytest -from flask import json -from werkzeug.utils import cached_property from .fixtures import accept_any from .fixtures import accept_json diff --git a/setup.py b/setup.py index 5e70edd..b73a107 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ #!/usr/bin/env python import os -from setuptools import find_packages from setuptools import setup diff --git a/tests/test_json_response.py b/tests/test_json_response.py index 370b1b7..51a9b34 100644 --- a/tests/test_json_response.py +++ b/tests/test_json_response.py @@ -1,5 +1,4 @@ import pytest -from flask import Flask from flask import url_for From 8480cddb763f4eb5621ea1a20a81630a0cfc29da Mon Sep 17 00:00:00 2001 From: northernSage Date: Thu, 3 Jun 2021 22:07:45 -0300 Subject: [PATCH 5/5] move start method declaration out of live server --- pytest_flask/live_server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pytest_flask/live_server.py b/pytest_flask/live_server.py index 0cd5600..e01d7af 100644 --- a/pytest_flask/live_server.py +++ b/pytest_flask/live_server.py @@ -9,6 +9,11 @@ import pytest +# force 'fork' on macOS +if platform.system() == "Darwin": + multiprocessing.set_start_method("fork") + + class LiveServer: """The helper class used to manage a live server. Handles creation and stopping application in a separate process. @@ -28,10 +33,6 @@ def __init__(self, app, host, port, wait, clean_stop=False): self.clean_stop = clean_stop self._process = None - # force fork on macOS - if platform.system() == "Darwin": - multiprocessing.set_start_method("fork") - def start(self): """Start application in a separate process."""