Skip to content

Commit a9ba60e

Browse files
authored
Merge pull request #330 from gyermolenko/remove_docker_machine
Remove docker-machine parts
2 parents 3fe6b5c + e009b06 commit a9ba60e

File tree

7 files changed

+11
-39
lines changed

7 files changed

+11
-39
lines changed

CONTRIBUTING.rst

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Fist of all just clone repository::
1010

1111
$ git clone [email protected]:aio-libs/aiohttp_admin.git
1212

13-
Install docker_ using instruction_ from the official site, for OSX we
14-
use docker-machine_.
13+
Install docker_ using instruction_ from the official site.
1514

1615
Create virtualenv with python3.5 (older version are not supported). For example
1716
using *virtualenvwrapper* commands could look like::
@@ -56,13 +55,6 @@ Among results you should find something like::
5655
mongo 2.6 150dd5b5bd1b 9 weeks ago 390.9 MB
5756

5857

59-
For OSX users one extra step is required, before running tests, please
60-
init environment variables::
61-
62-
$ eval $(docker-machine env default)
63-
$ export DOCKER_MACHINE_IP=$(docker-machine ip)
64-
65-
6658
Reporting an Issue
6759
------------------
6860
If you have found issue with `aiohttp-admin` please do
@@ -82,4 +74,3 @@ information:
8274

8375
.. _docker: https://www.docker.com/
8476
.. _instruction: https://docs.docker.com/engine/installation/linux/ubuntulinux/
85-
.. _docker-machine: https://docs.docker.com/machine/

demos/blog/aiohttpdemo_blog/utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import os
2-
31
import aiopg.sa
42
import yaml
53

@@ -12,8 +10,6 @@ def load_config(fname):
1210

1311

1412
async def init_postgres(conf, loop):
15-
host = os.environ.get('DOCKER_MACHINE_IP', '127.0.0.1')
16-
conf['host'] = host
1713
engine = await aiopg.sa.create_engine(
1814
database=conf['database'],
1915
user=conf['user'],

demos/motortwit/motortwit/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytz
2-
import os
32
import yaml
43
from hashlib import md5
54
from dateutil.parser import parse
@@ -16,8 +15,6 @@ def load_config(fname):
1615

1716

1817
async def init_mongo(conf, loop):
19-
host = os.environ.get('DOCKER_MACHINE_IP', '127.0.0.1')
20-
conf['host'] = host
2118
mongo_uri = "mongodb://{}:{}".format(conf['host'], conf['port'])
2219
conn = aiomotor.AsyncIOMotorClient(
2320
mongo_uri,

demos/polls/aiohttpdemo_polls/templates/detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ <h1>{{ question.question_text }}</h1>
22

33
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
44

5-
<form action="{{ url('vote', parts={'question_id': question.id}) }}" method="post">
5+
<form action="{{ url('vote', question_id=question.id) }}" method="post">
66
{% for choice in choices %}
77
<input type="radio" name="choice" id="choice{{ loop.index }}" value="{{ choice.id }}" />
88
<label for="choice{{ loop.index }}">{{ choice.choice_text }}</label><br />

demos/polls/aiohttpdemo_polls/templates/results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ <h1>{{ question.question }}</h1>
66
{% endfor %}
77
</ul>
88

9-
<a href="{{ url('poll', parts={'question_id': question.id}) }}">Vote again?</a>
9+
<a href="{{ url('poll', question_id=question.id) }}">Vote again?</a>

demos/polls/aiohttpdemo_polls/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import yaml
2-
import os
32
import aiopg.sa
43

54

@@ -11,8 +10,6 @@ def load_config(fname):
1110

1211

1312
async def init_postgres(conf, loop):
14-
host = os.environ.get('DOCKER_MACHINE_IP')
15-
conf['host'] = host
1613
engine = await aiopg.sa.create_engine(
1714
database=conf['database'],
1815
user=conf['user'],

tests/docker_fixtures.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import time
32
from pathlib import Path
43

@@ -8,7 +7,7 @@
87
import pytest
98

109
from docker import APIClient
11-
from docker import from_env
10+
1211

1312
TEMP_FOLDER = Path('/tmp') / 'aiohttp_admin'
1413

@@ -29,17 +28,9 @@ def session_id():
2928
return 'aiohttp-admin-session'
3029

3130

32-
@pytest.fixture(scope='session')
33-
def host():
34-
return os.environ.get('DOCKER_MACHINE_IP', '127.0.0.1')
35-
36-
3731
@pytest.fixture(scope='session')
3832
def docker():
39-
if os.environ.get('DOCKER_MACHINE_IP') is not None:
40-
docker = from_env(assert_hostname=False)
41-
else:
42-
docker = APIClient(version='auto')
33+
docker = APIClient(version='auto')
4334
return docker
4435

4536

@@ -105,7 +96,7 @@ def wait_for_container(callable, image, skip_exception):
10596

10697

10798
@pytest.fixture(scope='session')
108-
def pg_server(host, unused_port, container_starter):
99+
def pg_server(unused_port, container_starter):
109100
tag = "9.6"
110101
image = 'postgres:{}'.format(tag)
111102

@@ -123,7 +114,7 @@ def pg_server(host, unused_port, container_starter):
123114
params = dict(database='aiohttp_admin',
124115
user='aiohttp_admin_user',
125116
password='mysecretpassword',
126-
host=host,
117+
host='127.0.0.1',
127118
port=host_port)
128119

129120
def connect():
@@ -143,7 +134,7 @@ def mysql_params(mysql_server):
143134

144135

145136
@pytest.fixture(scope='session')
146-
def mysql_server(host, unused_port, container_starter):
137+
def mysql_server(unused_port, container_starter):
147138
tag = '5.7'
148139
image = 'mysql:{}'.format(tag)
149140

@@ -160,7 +151,7 @@ def mysql_server(host, unused_port, container_starter):
160151
params = dict(database='aiohttp_admin',
161152
user='aiohttp_admin_user',
162153
password='mysecretpassword',
163-
host=host,
154+
host='127.0.0.1',
164155
port=host_port)
165156

166157
def connect():
@@ -181,7 +172,7 @@ def mongo_params(mongo_server):
181172

182173

183174
@pytest.fixture(scope='session')
184-
def mongo_server(host, unused_port, container_starter):
175+
def mongo_server(unused_port, container_starter):
185176
tag = '3.3'
186177
image = 'mongo:{}'.format(tag)
187178

@@ -192,7 +183,7 @@ def mongo_server(host, unused_port, container_starter):
192183
container = container_starter(image, internal_port, host_port,
193184
volume=volume, command=command)
194185

195-
params = dict(host=host, port=host_port)
186+
params = dict(host='127.0.0.1', port=host_port)
196187

197188
def connect():
198189
client = pymongo.MongoClient(**params)

0 commit comments

Comments
 (0)