diff --git a/appveyor.yml b/appveyor.yml index be5003291f6..3601ead172d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,30 +12,29 @@ environment: # a later point release. # See: https://www.appveyor.com/docs/installed-software#python - - PYTHON: "C:\\Python27-x64" - PYTHON_VERSION: "2.7.x" - PYTHON_ARCH: "64" - WINDOWS_SDK_VERSION: "v7.0" - - PYTHON: "C:\\Python35-x64" PYTHON_VERSION: "3.5.x" PYTHON_ARCH: "64" WINDOWS_SDK_VERSION: "v7.1" + TOXENV: "3.5-unit" - PYTHON: "C:\\Python36-x64" PYTHON_VERSION: "3.6.x" PYTHON_ARCH: "64" WINDOWS_SDK_VERSION: "v7.1" - + TOXENV: "3.6-unit" + - PYTHON: "C:\\Python37-x64" PYTHON_VERSION: "3.7.x" PYTHON_ARCH: "64" WINDOWS_SDK_VERSION: "v7.1" - + TOXENV: "3.7-unit" + - PYTHON: "C:\\Python38-x64" PYTHON_VERSION: "3.8.x" PYTHON_ARCH: "64" WINDOWS_SDK_VERSION: "v7.1" + TOXENV: "3.8-unit" init: @@ -43,15 +42,14 @@ init: install: - "powershell extra\\appveyor\\install.ps1" - - "%PYTHON%/python -m pip install -U pip setuptools" + - "%PYTHON%/python -m pip install -U pip setuptools tox" - "%PYTHON%/Scripts/pip.exe install -U eventlet" - "%PYTHON%/Scripts/pip.exe install -U -r requirements/extras/thread.txt" - - "%PYTHON%/Scripts/pip.exe install -U -r requirements/test-ci-default.txt" build: off test_script: - - "%WITH_COMPILER% %PYTHON%/python setup.py test" + - "%WITH_COMPILER% %PYTHON%/Scripts/tox -v -- -v" after_test: - "%WITH_COMPILER% %PYTHON%/python setup.py bdist_wheel" diff --git a/celery/apps/multi.py b/celery/apps/multi.py index 90c9cf0356d..baa2fa8b9e1 100644 --- a/celery/apps/multi.py +++ b/celery/apps/multi.py @@ -151,8 +151,8 @@ def _setdefaultopt(self, d, alt, value): return d[opt] except KeyError: pass - path_split = value.split("/") - dir_path = "/".join(path_split[0:-1]) + value = os.path.normpath(value) + dir_path = os.path.dirname(value) if not os.path.exists(dir_path): os.makedirs(dir_path) return d.setdefault(alt[0], value) diff --git a/celery/contrib/testing/app.py b/celery/contrib/testing/app.py index d891c0ad34b..df3e06a9fbc 100644 --- a/celery/contrib/testing/app.py +++ b/celery/contrib/testing/app.py @@ -32,7 +32,7 @@ class Trap(object): def __getattr__(self, name): # Workaround to allow unittest.mock to patch this object # in Python 3.8 and above. - if name == '_is_coroutine': + if name == '_is_coroutine' or name == '__func__': return None print(name) raise RuntimeError('Test depends on current_app') diff --git a/requirements/extras/couchbase.txt b/requirements/extras/couchbase.txt index 948e06bd7b5..6099c04736e 100644 --- a/requirements/extras/couchbase.txt +++ b/requirements/extras/couchbase.txt @@ -1,2 +1,2 @@ -couchbase < 3.0.0 +couchbase < 3.0.0; platform_system != "Windows" couchbase-cffi < 3.0.0;platform_python_implementation=="PyPy" diff --git a/requirements/extras/memcache.txt b/requirements/extras/memcache.txt index a19a29cf28e..32da5dcc24a 100644 --- a/requirements/extras/memcache.txt +++ b/requirements/extras/memcache.txt @@ -1 +1 @@ -pylibmc +pylibmc; platform_system != "Windows" diff --git a/t/unit/apps/test_multi.py b/t/unit/apps/test_multi.py index 1d60c7259aa..16add3c48b1 100644 --- a/t/unit/apps/test_multi.py +++ b/t/unit/apps/test_multi.py @@ -3,6 +3,7 @@ import errno import signal import sys +import os import pytest from case import Mock, call, patch, skip @@ -113,8 +114,8 @@ def assert_line_in(name, args): def _args(name, *args): return args + ( - '--pidfile=/var/run/celery/{}.pid'.format(name), - '--logfile=/var/log/celery/{}%I.log'.format(name), + '--pidfile={}.pid'.format(os.path.join(os.path.normpath('/var/run/celery/'), name)), + '--logfile={}%I.log'.format(os.path.join(os.path.normpath('/var/log/celery/'), name)), '--executable={0}'.format(sys.executable), '', ) @@ -194,10 +195,10 @@ def test_from_kwargs(self): '--executable={0}'.format(n.executable), '-O fair', '-n foo@bar.com', - '--logfile=/var/log/celery/foo%I.log', + '--logfile={}'.format(os.path.normpath('/var/log/celery/foo%I.log')), '-Q q1,q2', '--max-tasks-per-child=30', - '--pidfile=/var/run/celery/foo.pid', + '--pidfile={}'.format(os.path.normpath('/var/run/celery/foo.pid')), '', ]) @@ -275,7 +276,7 @@ def test_handle_process_exit__signalled(self): def test_logfile(self): assert self.node.logfile == self.expander.return_value - self.expander.assert_called_with('/var/log/celery/%n%I.log') + self.expander.assert_called_with(os.path.normpath('/var/log/celery/%n%I.log')) class test_Cluster: @@ -375,8 +376,8 @@ def test_getpids(self): assert sorted(node_0.argv) == sorted([ '', '--executable={0}'.format(node_0.executable), - '--logfile=/var/log/celery/foo%I.log', - '--pidfile=/var/run/celery/foo.pid', + '--logfile={}'.format(os.path.normpath('/var/log/celery/foo%I.log')), + '--pidfile={}'.format(os.path.normpath('/var/run/celery/foo.pid')), '-m celery worker --detach', '-n foo@e.com', ]) @@ -386,8 +387,8 @@ def test_getpids(self): assert sorted(node_1.argv) == sorted([ '', '--executable={0}'.format(node_1.executable), - '--logfile=/var/log/celery/bar%I.log', - '--pidfile=/var/run/celery/bar.pid', + '--logfile={}'.format(os.path.normpath('/var/log/celery/bar%I.log')), + '--pidfile={}'.format(os.path.normpath('/var/run/celery/bar.pid')), '-m celery worker --detach', '-n bar@e.com', ]) @@ -404,8 +405,8 @@ def __init__(self, path): def read_pid(self): try: - return {'/var/run/celery/foo.pid': 10, - '/var/run/celery/bar.pid': 11}[self.path] + return {os.path.normpath('/var/run/celery/foo.pid'): 10, + os.path.normpath('/var/run/celery/bar.pid'): 11}[self.path] except KeyError: raise ValueError() self.Pidfile.side_effect = pids diff --git a/t/unit/worker/test_worker.py b/t/unit/worker/test_worker.py index d8a0aae0737..6112cf253bd 100644 --- a/t/unit/worker/test_worker.py +++ b/t/unit/worker/test_worker.py @@ -792,6 +792,7 @@ def test_with_autoscaler(self): ) assert worker.autoscaler + @skip.if_win32() @pytest.mark.nothreads_not_lingering @mock.sleepdeprived(module=autoscale) def test_with_autoscaler_file_descriptor_safety(self): @@ -841,6 +842,7 @@ def test_with_autoscaler_file_descriptor_safety(self): worker.terminate() worker.pool.terminate() + @skip.if_win32() @pytest.mark.nothreads_not_lingering @mock.sleepdeprived(module=autoscale) def test_with_file_descriptor_safety(self): diff --git a/tox.ini b/tox.ini index 0e67c97ad72..4f22d22b47e 100644 --- a/tox.ini +++ b/tox.ini @@ -68,7 +68,6 @@ basepython = flake8,apicheck,linkcheck,configcheck,pydocstyle,bandit: python3.8 flakeplus: python2.7 usedevelop = True -install_command = {toxinidir}/tox_install_command.sh {opts} {packages} [testenv:apicheck] setenv = diff --git a/tox_install_command.sh b/tox_install_command.sh deleted file mode 100755 index ff7ec4222a1..00000000000 --- a/tox_install_command.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -pip --disable-pip-version-check install "$@" - -if [[ "${TRAVIS_PYTHON_VERSION}" == "3.7" ]]; then - # We have to uninstall the typing package which comes along with - # the couchbase package in order to prevent an error on CI for Python 3.7. - pip uninstall typing -y -fi