From 155ed4bb50ec79bfa16aad867f492f325b608cfa Mon Sep 17 00:00:00 2001 From: Matus Valo Date: Fri, 15 Feb 2019 06:09:40 -0800 Subject: Added RabbitMQ windows tests --- appveyor.yml | 16 +++++++++++++++- extra/appveyor/install_rmq.ps1 | 37 +++++++++++++++++++++++++++++++++++++ setup.py | 9 ++++++++- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 extra/appveyor/install_rmq.ps1 diff --git a/appveyor.yml b/appveyor.yml index 0a1bddd..17cb4d1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,14 @@ environment: + erlang_download_url: "http://erlang.org/download/otp_win64_19.3.exe" + erlang_exe_path: "C:\\Users\\appveyor\\erlang_19.3.exe" + erlang_home_dir: "C:\\Users\\appveyor\\erlang" + erlang_erts_version: "erts-8.3" + + rabbitmq_version: 3.7.4 + rabbitmq_installer_download_url: "https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.4/rabbitmq-server-3.7.4.exe" + rabbitmq_installer_path: "C:\\Users\\appveyor\\rabbitmq-server-3.7.4.exe" + global: # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the # /E:ON and /V:ON options are not enabled in the batch script intepreter @@ -51,14 +60,19 @@ environment: init: - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" +cache: + - "%erlang_exe_path%" + - "%rabbitmq_installer_path%" + install: - "powershell extra\\appveyor\\install.ps1" + - "powershell extra\\appveyor\\install_rmq.ps1" - "%PYTHON%/Scripts/pip.exe install -U setuptools" build: off test_script: - - "%WITH_COMPILER% %PYTHON%/python setup.py test" + - "%WITH_COMPILER% %PYTHON%/python setup.py test -E rabbitmq" after_test: - "%WITH_COMPILER% %PYTHON%/python setup.py bdist_wheel" diff --git a/extra/appveyor/install_rmq.ps1 b/extra/appveyor/install_rmq.ps1 new file mode 100644 index 0000000..57e3f65 --- /dev/null +++ b/extra/appveyor/install_rmq.ps1 @@ -0,0 +1,37 @@ +$webclient=New-Object System.Net.WebClient + +Write-Host "Downloading Erlang..." +if (-Not (Test-Path "$env:erlang_exe_path")) { + $webclient.DownloadFile("$env:erlang_download_url", "$env:erlang_exe_path") +} else { + Write-Host "Found" $env:erlang_exe_path "in cache." +} + +Write-Host "Installing Erlang to" $env:erlang_home_dir "..." +mkdir $env:erlang_home_dir +cd $env:erlang_home_dir +& $env:erlang_exe_path "/S" + +Write-Host "Downloading RabbitMQ..." +if (-Not (Test-Path "$env:rabbitmq_installer_path")) { + $webclient.DownloadFile("$env:rabbitmq_installer_download_url", "$env:rabbitmq_installer_path") +} else { + Write-Host "Found" $env:rabbitmq_installer_path "in cache." +} + +Write-Host "Creating directory" $env:AppData "\RabbitMQ..." +New-Item -ItemType Directory -ErrorAction Continue -Path "$env:AppData/RabbitMQ" + +Write-Host "Creating Erlang cookie files..." +[System.IO.File]::WriteAllText("C:\Users\appveyor\.erlang.cookie", "PYAMQP", [System.Text.Encoding]::ASCII) +[System.IO.File]::WriteAllText("C:\Windows\System32\config\systemprofile\.erlang.cookie", "PYAMQP", [System.Text.Encoding]::ASCII) + +Write-Host "Installing and starting RabbitMQ with default config..." +& $env:rabbitmq_installer_path '/S' | Out-Null +(Get-Service -Name RabbitMQ).Status + +# wait 60 seconds to start RabbitMQ +Start-Sleep -Seconds 60 + +Write-Host "Getting RabbitMQ status..." +cmd /c "C:\Program Files\RabbitMQ Server\rabbitmq_server-$env:rabbitmq_version\sbin\rabbitmqctl.bat" status diff --git a/setup.py b/setup.py index 3d3d9e4..31080ef 100644 --- a/setup.py +++ b/setup.py @@ -90,17 +90,24 @@ else: class pytest(setuptools.command.test.test): - user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')] + user_options = [ + ('pytest-args=', 'a', 'Arguments to pass to py.test'), + ('pytest-env=', 'E', 'Only run tests matching the environment'), + ] def initialize_options(self): setuptools.command.test.test.initialize_options(self) self.pytest_args = '' + self.pytest_env = None def run_tests(self): import pytest pytest_args = self.pytest_args.split(' ') + if self.pytest_env: + pytest_args = pytest_args + ['-E', self.pytest_env] sys.exit(pytest.main(pytest_args)) + setuptools.setup( name=NAME, packages=setuptools.find_packages(exclude=['ez_setup', 't', 't.*']), -- cgit v1.2.1