diff options
author | Matus Valo <matusvalo@gmail.com> | 2019-02-15 06:09:40 -0800 |
---|---|---|
committer | Matus Valo <matusvalo@gmail.com> | 2019-02-20 06:39:57 +0100 |
commit | 155ed4bb50ec79bfa16aad867f492f325b608cfa (patch) | |
tree | 695fa39bf9b700102ebad2bc053e099b874ec50e | |
parent | b2a0269e147f0052603b19647744e1829ff07f61 (diff) | |
download | py-amqp-CI-WIN-RMQ.tar.gz |
Added RabbitMQ windows testsCI-WIN-RMQ
-rw-r--r-- | appveyor.yml | 16 | ||||
-rw-r--r-- | extra/appveyor/install_rmq.ps1 | 37 | ||||
-rw-r--r-- | setup.py | 9 |
3 files changed, 60 insertions, 2 deletions
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 @@ -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.*']), |