fix test break because couchdb failing to start

This commit is contained in:
binux 2020-07-26 16:20:28 -07:00
parent 15157ea35c
commit 3e261d356b
4 changed files with 11 additions and 19 deletions

View File

@ -2,7 +2,6 @@ sudo: required
language: python
cache: pip
python:
- 3.4
- 3.5
- 3.6
- 3.7
@ -13,8 +12,9 @@ services:
- rabbitmq
- redis-server
- mysql
#- elasticsearch
# - elasticsearch
- postgresql
- couchdb
addons:
postgresql: "9.4"
apt:
@ -22,18 +22,12 @@ addons:
- rabbitmq-server
before_install:
- echo "deb https://apache.bintray.com/couchdb-deb xenial main" | sudo tee -a /etc/apt/sources.list
- curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -
- sudo apt-get update -qq
- sudo apt-get install -y couchdb
- sudo systemctl start couchdb
- curl -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.0/elasticsearch-2.4.0.deb && sudo dpkg -i --force-confnew elasticsearch-2.4.0.deb && sudo service elasticsearch restart
- npm install express puppeteer
- sudo docker pull scrapinghub/splash
- sudo docker run -d --net=host scrapinghub/splash
before_script:
- curl -X PUT http://127.0.0.1:5984/_users
- curl -X PUT http://127.0.0.1:5984/_replicator
- psql -c "CREATE DATABASE pyspider_test_taskdb ENCODING 'UTF8' TEMPLATE=template0;" -U postgres
- psql -c "CREATE DATABASE pyspider_test_projectdb ENCODING 'UTF8' TEMPLATE=template0;" -U postgres
- psql -c "CREATE DATABASE pyspider_test_resultdb ENCODING 'UTF8' TEMPLATE=template0;" -U postgres

View File

@ -432,9 +432,9 @@ def python_console(namespace=None):
def check_port_open(port, addr='127.0.0.1'):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex((addr, port))
if result == 0:
return True
else:
return False
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
result = sock.connect_ex((addr, port))
if result == 0:
return True
else:
return False

View File

@ -72,9 +72,6 @@ setup(
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
@ -100,7 +97,8 @@ setup(
'all': extras_require_all,
'test': [
'coverage',
'httpbin<=0.5.0',
'Werkzeug==0.16.1',
'httpbin==0.7.0',
'pyproxy==0.1.6',
'easywebdav==1.2.0',
]

View File

@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,py33,py34,py35
envlist = py35,py36,py37,py38
[testenv]
install_command =
pip install --allow-all-external 'https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.1.5.zip#md5=ce4a24cb1746c1c8f6189a97087f21c1' {opts} -e .[all,test] {packages}