Skip to content

Commit

Permalink
Scheduled monthly dependency update for November (#210)
Browse files Browse the repository at this point in the history
* Update pytest from 3.8.1 to 3.9.3

* Update pytest from 3.8.1 to 3.9.3

* Update pytest-cov from 2.5.1 to 2.6.0

* Update pytest-cov from 2.5.1 to 2.6.0

* Update aiohttp-jinja2 from 1.0.0 to 1.1.0

* Update aiohttp-jinja2 from 1.0.0 to 1.1.0

* Update aiohttp-session from 2.5.1 to 2.7.0

* Update aiohttp-session from 2.6.0 to 2.7.0

* Update aiohttp-session from 2.6.0 to 2.7.0

* Update sqlalchemy from 1.2.11 to 1.2.13

* Update sqlalchemy from 1.2.11 to 1.2.13

* Update flake8 from 3.5.0 to 3.6.0

* Update pycodestyle from 2.3.1 to 2.4.0

* Update pytest-isort from 0.2.0 to 0.2.1

* Update pytest-xdist from 1.23.0 to 1.24.0

* Update sphinx from 1.7.8 to 1.8.1

* fix linting

* fix deprecation warnings

* fixing tests

* fix release date

* fix coverage combine
  • Loading branch information
pyup.io bot authored and samuelcolvin committed Nov 19, 2018
1 parent cff6db0 commit 2dcfd09
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 64 deletions.
2 changes: 1 addition & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
History
-------

0.10.4 (2018-11-18)
0.10.4 (2018-11-19)
-------------------
* fix conflict with click checks that prevented the ``--root`` flag working properly, #206
* uprev dependencies
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ lint:

.PHONY: test
test:
pytest --cov=aiohttp_devtools --boxed --duration 5 && coverage combine
pytest --cov=aiohttp_devtools --boxed --duration 5 && (coverage combine || test 0)

.PHONY: testcov
testfast:
Expand Down
8 changes: 4 additions & 4 deletions aiohttp_devtools/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def get_metavar(self, param):


DECISIONS = [
('template_engine', TemplateChoice),
('session', SessionChoices),
('database', DatabaseChoice),
('example', ExampleChoice),
('template_engine', TemplateChoice),
('session', SessionChoices),
('database', DatabaseChoice),
('example', ExampleChoice),
]


Expand Down
2 changes: 1 addition & 1 deletion aiohttp_devtools/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_log_format(record):
class DefaultHandler(logging.Handler):
def emit(self, record):
log_entry = self.format(record)
m = re.match('^(\[.*?\])', log_entry)
m = re.match(r'^(\[.*?\])', log_entry)
if m:
time = click.style(m.groups()[0], fg='magenta')
msg = click.style(log_entry[m.end():], **get_log_format(record))
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_devtools/runserver/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from ..logs import rs_dft_logger as logger

STD_FILE_NAMES = [
re.compile('main\.py'),
re.compile('app\.py'),
re.compile(r'main\.py'),
re.compile(r'app\.py'),
]


Expand Down
4 changes: 2 additions & 2 deletions aiohttp_devtools/runserver/log_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AuxiliaryHandler(logging.Handler):

def emit(self, record):
log_entry = self.format(record)
m = re.match('^(\[.*?\] )', log_entry)
m = re.match(r'^(\[.*?\] )', log_entry)
time = click.style(m.groups()[0], fg='magenta')
msg = log_entry[m.end():]
if record.levelno in {logging.INFO, logging.DEBUG} and msg.startswith('>'):
Expand All @@ -33,7 +33,7 @@ class AiohttpAccessHandler(logging.Handler):

def emit(self, record):
log_entry = self.format(record)
m = re.match('^(\[.*?\] )', log_entry)
m = re.match(r'^(\[.*?\] )', log_entry)
time = click.style(m.groups()[0], fg='magenta')
msg = log_entry[m.end():]
try:
Expand Down
14 changes: 7 additions & 7 deletions aiohttp_devtools/start/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

FILES_REGEXES = {
'.py': [
('^ *# *\n', '', re.M), # blank comments
('\n *# *$', '', 0), # blank comment at end of fie
('\n{4,}', '\n\n\n', 0), # more than 2 empty lines
('^\s+', '', 0), # leading new lines
(r'^ *# *\n', '', re.M), # blank comments
(r'\n *# *$', '', 0), # blank comment at end of fie
(r'\n{4,}', '\n\n\n', 0), # more than 2 empty lines
(r'^\s+', '', 0), # leading new lines
],
'.sh': [
('^ *# *\n', '', re.M), # blank comments
('\n *# *$', '', 0), # blank comment at end of fie
(r'^ *# *\n', '', re.M), # blank comments
(r'\n *# *$', '', 0), # blank comment at end of fie
],
}

Expand Down Expand Up @@ -126,7 +126,7 @@ def __init__(self, *,
logger.info('config:\n%s', '\n'.join(' {}: {}'.format(*c) for c in display_config))
self.ctx = {
'name': name,
'clean_name': re.sub('[^\w_]', '', re.sub('[.-]', '_', name)),
'clean_name': re.sub(r'[^\w_]', '', re.sub(r'[.-]', '_', name)),
'cookie_secret_key': base64.urlsafe_b64encode(os.urandom(32)).decode(),
'template_engine': self._choice_context(template_engine, TemplateChoice),
'session': self._choice_context(session, SessionChoices),
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_devtools/start/template/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ async def message_data(request):
username, ts, message = line.split('|', 2)
# parse the datetime string and render it in a more readable format.
ts = '{:%Y-%m-%d %H:%M:%S}'.format(datetime.strptime(ts, '%Y-%m-%dT%H:%M:%S.%f'))
messages.append({'username': username, 'timestamp': ts, 'message': message})
messages.append({'username': username, 'timestamp': ts, 'message': message})
messages.reverse()
# {% elif database.is_pg_sqlalchemy %}

async with request.app['pg_engine'].acquire() as conn:
async for row in conn.execute(sa_messages.select().order_by(sa_messages.c.timestamp.desc())):
ts = '{:%Y-%m-%d %H:%M:%S}'.format(row.timestamp)
messages.append({'username': row.username, 'timestamp': ts, 'message': row.message})
messages.append({'username': row.username, 'timestamp': ts, 'message': row.message})
# {% endif %}
return json_response(messages)
# {% endif %}
10 changes: 5 additions & 5 deletions aiohttp_devtools/start/template/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# you will need to install these requirements with `pip install -r requirements.txt`

aiohttp==3.4.4
pytest==3.8.1
pytest==3.9.3
pytest-aiohttp==0.3.0
pytest-cov==2.5.1
pytest-cov==2.6.0

# {% if template_engine.is_jinja %}
aiohttp-jinja2==1.0.0
aiohttp-jinja2==1.1.0
# {% endif %}

# {% if session.is_secure %}
aiohttp-session[secure]==2.5.1
aiohttp-session[secure]==2.7.0
# {% endif %}

# {% if database.is_pg_sqlalchemy %}
aiopg==0.15.0
SQLAlchemy==1.2.11
SQLAlchemy==1.2.13
# {% endif %}
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ timeout = 10
isort_ignore =
aiohttp_devtools/start/template/*.py
tests/test_runserver_main.py
filterwarnings =
ignore::DeprecationWarning:aiohttp_debugtoolbar.tbtools.tbtools

[flake8]
max-line-length = 120
max-complexity = 10
exclude = aiohttp_devtools/start/template
# remove E252 once https://github.com/PyCQA/pycodestyle/issues/753 is released
ignore = E252, W504

[bdist_wheel]
python-tag = py35.py36
Expand Down
23 changes: 12 additions & 11 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
click==7.0.0
coverage==4.5.1
docutils==0.14
flake8==3.5.0
flake8==3.6.0
grablib==0.6.1 # pyup: ignore (last version which is compatible with python 3.5)
pycodestyle==2.3.1
pycodestyle==2.4.0
pyflakes==2.0.0
pytest==3.8.1
pytest==3.9.3
pytest-aiohttp==0.3.0
pytest-cov==2.5.1
pytest-isort==0.2.0
pytest-cov==2.6.0
pytest-isort==0.2.1
pytest-mock==1.10.0
pytest-sugar==0.9.1
pytest-timeout==1.3.2
pytest-toolbox==0.4
pytest-xdist==1.23.0
Sphinx==1.7.8
pytest-xdist==1.24.0
Sphinx==1.8.1

# required to run "start" apps
aiohttp-jinja2==1.0.0
aiohttp-session[secure]==2.6.0
aiohttp-session[aioredis]==2.6.0
aiohttp-jinja2==1.1.0
aiohttp-session[secure]==2.7.0
aiohttp-session[aioredis]==2.7.0
aiopg==0.15.0
SQLAlchemy==1.2.11
SQLAlchemy==1.2.13
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_serve_no_args():
runner = CliRunner()
result = runner.invoke(cli, ['serve'])
assert result.exit_code == 2
assert 'error: missing argument "path"' in result.output.lower()
assert 'Error: Missing argument "PATH"' in result.output


def test_runserver(mocker):
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_start_no_args():
runner = CliRunner()
result = runner.invoke(cli, ['start'])
assert result.exit_code == 2
assert 'error: missing argument "path"' in result.output.lower()
assert 'Error: Missing argument "PATH"' in result.output


def test_start_help():
Expand Down
16 changes: 8 additions & 8 deletions tests/test_runserver_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,34 +118,34 @@ def kill_parent_soon(pid):

@if_boxed
@slow
def test_run_app(loop, unused_port):
def test_run_app(loop, aiohttp_unused_port):
app = Application()
port = unused_port()
port = aiohttp_unused_port()
Process(target=kill_parent_soon, args=(os.getpid(),)).start()
run_app(app, port, loop)


@if_boxed
async def test_run_app_test_client(tmpworkdir, test_client):
async def test_run_app_aiohttp_client(tmpworkdir, aiohttp_client):
mktree(tmpworkdir, SIMPLE_APP)
config = Config(app_path='app.py')
app_factory = config.import_app_factory()
app = app_factory()
modify_main_app(app, config)
assert isinstance(app, aiohttp.web.Application)
cli = await test_client(app)
cli = await aiohttp_client(app)
r = await cli.get('/')
assert r.status == 200
text = await r.text()
assert text == 'hello world'


async def test_aux_app(tmpworkdir, test_client):
async def test_aux_app(tmpworkdir, aiohttp_client):
mktree(tmpworkdir, {
'test.txt': 'test value',
})
app = create_auxiliary_app(static_path='.')
cli = await test_client(app)
cli = await aiohttp_client(app)
r = await cli.get('/test.txt')
assert r.status == 200
text = await r.text()
Expand Down Expand Up @@ -189,9 +189,9 @@ async def hello(request):


@pytest.yield_fixture
def aux_cli(test_client, loop):
def aux_cli(aiohttp_client, loop):
app = create_auxiliary_app(static_path='.')
cli = loop.run_until_complete(test_client(app))
cli = loop.run_until_complete(aiohttp_client(app))
yield cli
loop.run_until_complete(cli.close())

Expand Down
8 changes: 4 additions & 4 deletions tests/test_runserver_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
)


async def test_check_port_open(unused_port, loop):
port = unused_port()
async def test_check_port_open(aiohttp_unused_port, loop):
port = aiohttp_unused_port()
await check_port_open(port, loop, 0.001)


@non_windows_test # FIXME: probably needs some sock options
async def test_check_port_not_open(unused_port, loop):
port = unused_port()
async def test_check_port_not_open(aiohttp_unused_port, loop):
port = aiohttp_unused_port()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.bind(('0.0.0.0', port))
with pytest.raises(AiohttpDevException):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_runserver_watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ async def test_python_no_server(loop, mocker):
await app_task._session.close()


async def test_reload_server_running(loop, test_client, mocker):
async def test_reload_server_running(loop, aiohttp_client, mocker):
app = Application()
app['websockets'] = [None]
mock_src_reload = mocker.patch('aiohttp_devtools.runserver.watch.src_reload', return_value=create_future())
cli = await test_client(app)
cli = await aiohttp_client(app)
config = MagicMock()
config.main_port = cli.server.port

Expand Down
12 changes: 6 additions & 6 deletions tests/test_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@


@pytest.yield_fixture
def cli(loop, tmpworkdir, test_client):
def cli(loop, tmpworkdir, aiohttp_client):
asyncio.set_event_loop(loop)
app, _, _ = serve_static(static_path=str(tmpworkdir), livereload=False)
yield loop.run_until_complete(test_client(app))
yield loop.run_until_complete(aiohttp_client(app))


async def test_simple_serve(cli, tmpworkdir):
Expand All @@ -32,10 +32,10 @@ async def test_file_missing(cli):
assert '404: Not Found\n' in text


async def test_html_file_livereload(loop, test_client, tmpworkdir):
async def test_html_file_livereload(loop, aiohttp_client, tmpworkdir):
app, port, _ = serve_static(static_path=str(tmpworkdir), livereload=True)
assert port == 8000
cli = await test_client(app)
cli = await aiohttp_client(app)
mktree(tmpworkdir, {
'foo.html': '<h1>hi</h1>',
})
Expand All @@ -51,10 +51,10 @@ async def test_html_file_livereload(loop, test_client, tmpworkdir):
assert text.startswith('(function e(t,n,r){')


async def test_serve_index(loop, test_client, tmpworkdir):
async def test_serve_index(loop, aiohttp_client, tmpworkdir):
app, port, _ = serve_static(static_path=str(tmpworkdir), livereload=False)
assert port == 8000
cli = await test_client(app)
cli = await aiohttp_client(app)
mktree(tmpworkdir, {
'index.html': '<h1>hello index</h1>',
})
Expand Down
12 changes: 6 additions & 6 deletions tests/test_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_start_simple(tmpdir, smart_caplog):


@if_boxed
async def test_start_other_dir(tmpdir, loop, test_client, smart_caplog):
async def test_start_other_dir(tmpdir, loop, aiohttp_client, smart_caplog):
StartProject(path=str(tmpdir.join('the-path')), name='foobar', database=DatabaseChoice.NONE)
assert {p.basename for p in tmpdir.listdir()} == {'the-path'}
assert {p.basename for p in tmpdir.join('the-path').listdir()} == {
Expand All @@ -79,7 +79,7 @@ async def test_start_other_dir(tmpdir, loop, test_client, smart_caplog):
modify_main_app(app, config)
assert isinstance(app, aiohttp.web.Application)

cli = await test_client(app)
cli = await aiohttp_client(app)
r = await cli.get('/')
assert r.status == 200
text = await r.text()
Expand All @@ -103,7 +103,7 @@ def test_conflicting_file(tmpdir):
enum_choices(DatabaseChoice),
enum_choices(ExampleChoice),
))
async def test_all_options(tmpdir, test_client, loop, template_engine, session, database, example):
async def test_all_options(tmpdir, aiohttp_client, loop, template_engine, session, database, example):
StartProject(
path=str(tmpdir),
name='foobar',
Expand All @@ -123,7 +123,7 @@ async def test_all_options(tmpdir, test_client, loop, template_engine, session,
app_factory = config.import_app_factory()
app = await app_factory()
modify_main_app(app, config)
cli = await test_client(app)
cli = await aiohttp_client(app)
r = await cli.get('/')
assert r.status == 200
text = await r.text()
Expand All @@ -132,7 +132,7 @@ async def test_all_options(tmpdir, test_client, loop, template_engine, session,

@if_boxed
@slow
async def test_db_creation(tmpdir, test_client, loop):
async def test_db_creation(tmpdir, aiohttp_client, loop):
StartProject(
path=str(tmpdir),
name='foobar postgres test',
Expand Down Expand Up @@ -162,7 +162,7 @@ async def test_db_creation(tmpdir, test_client, loop):
app_factory = config.import_app_factory()
app = await app_factory()
modify_main_app(app, config)
cli = await test_client(app)
cli = await aiohttp_client(app)
r = await cli.get('/')
assert r.status == 200
text = await r.text()
Expand Down

0 comments on commit 2dcfd09

Please sign in to comment.