Tests: Replace gunicorn with waitress (works on Windows too)
This commit is contained in:
parent
941bb157cc
commit
9603aa3496
@ -38,11 +38,6 @@ from radicale import config, server
|
||||
from radicale.tests import BaseTest
|
||||
from radicale.tests.helpers import configuration_to_dict, get_file_path
|
||||
|
||||
try:
|
||||
import gunicorn
|
||||
except ImportError:
|
||||
gunicorn = None
|
||||
|
||||
|
||||
class DisabledRedirectHandler(request.HTTPRedirectHandler):
|
||||
def http_error_302(self, req, fp, code, msg, headers):
|
||||
@ -174,7 +169,6 @@ class TestBaseServerRequests(BaseTest):
|
||||
if os.name == "posix":
|
||||
assert p.returncode == 0
|
||||
|
||||
@pytest.mark.skipif(not gunicorn, reason="gunicorn module not found")
|
||||
def test_wsgi_server(self):
|
||||
config_path = os.path.join(self.colpath, "config")
|
||||
parser = RawConfigParser()
|
||||
@ -183,14 +177,13 @@ class TestBaseServerRequests(BaseTest):
|
||||
parser.write(f)
|
||||
env = os.environ.copy()
|
||||
env["PYTHONPATH"] = os.pathsep.join(sys.path)
|
||||
env["RADICALE_CONFIG"] = config_path
|
||||
p = subprocess.Popen([
|
||||
sys.executable,
|
||||
"-c", "from gunicorn.app.wsgiapp import run; run()",
|
||||
"--bind", self.configuration.get_raw("server", "hosts"),
|
||||
"--env", "RADICALE_CONFIG=%s" % config_path, "radicale"], env=env)
|
||||
sys.executable, "-m", "waitress",
|
||||
"--listen", self.configuration.get_raw("server", "hosts"),
|
||||
"radicale:application"], env=env)
|
||||
try:
|
||||
self.get("/", is_alive_fn=lambda: p.poll() is None, check=302)
|
||||
finally:
|
||||
p.terminate()
|
||||
p.wait()
|
||||
assert p.returncode == 0
|
||||
|
5
setup.py
5
setup.py
@ -36,7 +36,6 @@ For further information, please visit the `Radicale Website
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
@ -53,9 +52,7 @@ WEB_FILES = ["web/internal_data/css/icon.png",
|
||||
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
|
||||
pytest_runner = ["pytest-runner"] if needs_pytest else []
|
||||
tests_require = ["pytest-runner", "pytest", "pytest-cov", "pytest-flake8",
|
||||
"pytest-isort"]
|
||||
if os.name == "posix":
|
||||
tests_require.append("gunicorn")
|
||||
"pytest-isort", "waitress"]
|
||||
|
||||
setup(
|
||||
name="Radicale",
|
||||
|
Loading…
Reference in New Issue
Block a user