summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@gmail.com>2019-02-15 06:09:40 -0800
committerMatus Valo <matusvalo@gmail.com>2019-04-10 00:01:57 -0700
commit072e19f192973ca2f5a82b1fcef134888b0dcceb (patch)
tree943c49ac5b82864968e38cc55dedabc7717ceb29
parent79833d3e261ad89638ad41c997b31f29a61eb6bf (diff)
downloadpy-amqp-windows-integration_tests.tar.gz
Added RabbitMQ windows testswindows-integration_tests
Conflicts: appveyor.yml
-rw-r--r--appveyor.yml18
-rw-r--r--extra/appveyor/install_rmq.ps137
-rw-r--r--setup.py9
-rw-r--r--t/integration/conftest.py3
-rw-r--r--tox.ini3
5 files changed, 67 insertions, 3 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 45a61d1..4ae57c9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,13 @@
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"
+
matrix:
- TOXENV: "2.7"
TOX_APPVEYOR_X64: 0
@@ -32,11 +41,20 @@ environment:
build: off
+configuration:
+ - unit
+ - windows-integration-rabbitmq
+
install:
- "py -3.7 -m pip install -U pip setuptools wheel tox tox-appveyor"
+ - ps: if ($env:CONFIGURATION -eq "windows-integration-rabbitmq") {powershell extra\\appveyor\\install_rmq.ps1}
test_script:
+ - ps: $env:TOXENV="$env:TOXENV-$env:CONFIGURATION"
- "py -3.7 -m tox"
+ # - "%WITH_COMPILER% %PYTHON%/python setup.py test -E rabbitmq"
cache:
+- "%erlang_exe_path%"
+- "%rabbitmq_installer_path%"
- '%LOCALAPPDATA%\pip\Cache'
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 12d6e62..3458a07 100644
--- a/setup.py
+++ b/setup.py
@@ -91,17 +91,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.*']),
diff --git a/t/integration/conftest.py b/t/integration/conftest.py
index 4880e5c..dc4e9dd 100644
--- a/t/integration/conftest.py
+++ b/t/integration/conftest.py
@@ -1,10 +1,11 @@
from __future__ import absolute_import, unicode_literals
import os
+import sys
import subprocess
def pytest_sessionfinish(session, exitstatus):
tox_env_dir = os.environ.get('TOX_WORK_DIR')
- if exitstatus and tox_env_dir:
+ if exitstatus and tox_env_dir and sys.platform.startswith('linux'):
subprocess.call(["bash", "./rabbitmq_logs.sh"])
diff --git a/tox.ini b/tox.ini
index 1fb953c..dd6f8fd 100644
--- a/tox.ini
+++ b/tox.ini
@@ -2,6 +2,7 @@
envlist =
{2.7,pypy2.7-6.0,pypy3.5-6.0,3.4,3.5,3.6,3.7}-unit
{2.7,pypy2.7-6.0,pypy3.5-6.0,3.4,3.5,3.6,3.7}-integration-rabbitmq
+ {2.7,pypy2.7-6.0,pypy3.5-6.0,3.4,3.5,3.6,3.7}-windows-integration-rabbitmq
flake8
flakeplus
apicheck
@@ -29,7 +30,7 @@ basepython =
3.7: python3.7
install_command = python -m pip --disable-pip-version-check install {opts} {packages}
commands_pre =
- integration-rabbitmq: ./wait_for_rabbitmq.sh
+ !windows-integration-rabbitmq: ./wait_for_rabbitmq.sh
docker =
integration-rabbitmq: rabbitmq:alpine
dockerenv = PYAMQP_INTEGRATION_INSTANCE=1