Skip to content

Commit

Permalink
Merge pull request #2 from fizyk/linters
Browse files Browse the repository at this point in the history
Linter fixes
  • Loading branch information
fizyk committed Oct 18, 2016
2 parents e44e900 + 798dafa commit b9d85a4
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ commit = True
tag = True
message = "Release {new_version}"

[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'

[bumpversion:file:src/pytest_dynamodb/__init__.py]

[bumpversion:file:README.rst]
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytest-dynamodb
====
=====

.. image:: https://img.shields.io/pypi/v/pytest-dynamodb.svg
:target: https://pypi.python.org/pypi/pytest-dynamodb/
Expand Down
1 change: 1 addition & 0 deletions pylama.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
linters = pep8,pyflakes,pydocstyle
skip = docs/*,\
build/*
ignore=D212,D203
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

# You should have received a copy of the GNU Lesser General Public License
# along with pytest-dynamodb. If not, see <http://www.gnu.org/licenses/>.

"""pytest-dynamodb's installation module."""

import os
import re
from setuptools import setup, find_packages

here = os.path.dirname(__file__)
with open(os.path.join(here, 'src', 'pytest_dynamodb', '__init__.py')) as v_file:
package_version = re.compile(r".*__version__ = '(.*?)'", re.S).match(v_file.read()).group(1)


def read(fname):
Expand Down Expand Up @@ -57,7 +54,7 @@ def read(fname):

setup(
name='pytest-dynamodb',
version=package_version,
version='0.0.0',
description='DynamoDB fixtures for pytest',
long_description=(
read('README.rst') + '\n\n' + read('CHANGES.rst')
Expand All @@ -71,7 +68,8 @@ def read(fname):
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)',
'License :: OSI Approved :: '
'GNU Lesser General Public License v3 or later (LGPLv3+)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_dynamodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# You should have received a copy of the GNU Lesser General Public License
# along with pytest-dynamodb. If not, see <http://www.gnu.org/licenses/>.

"""Main module for pytest-dynamodb."""

import logging

Expand Down
28 changes: 17 additions & 11 deletions src/pytest_dynamodb/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

# You should have received a copy of the GNU Lesser General Public License
# along with pytest-dynamodb. If not, see <http://www.gnu.org/licenses/>.
import pytest
"""Module containing factories for pytest-dynamodb."""

import pytest
import boto3
from path import Path
from mirakuru import TCPExecutor
Expand All @@ -25,14 +26,16 @@


class JarPathException(Exception):
"""We do not know where user has dynamodb jar file.
"""
Exception thrown, i ncase we can't locate dynamodb's dir to run dynamodb.
We do not know where user has dynamodb jar file.
So, we want to tell him that he has to provide a path to dynamodb dir.
"""

We raise the exception when we won't find this file."""
pass



def get_config(request):
"""Return a dictionary with config options."""
config = {}
Expand All @@ -49,7 +52,7 @@ def get_config(request):

def dynamodb_proc(dynamodb_dir=None, host='localhost', port=None, delay=False):
"""
DynamoDB process factory.
Process fixture factory for DynamoDB.
:param str dynamodb_dir: a path to dynamodb dir (without spaces)
:param str host: hostname
Expand All @@ -66,15 +69,19 @@ def dynamodb_proc(dynamodb_dir=None, host='localhost', port=None, delay=False):
@pytest.fixture(scope='session')
def dynamodb_proc_fixture(request):
"""
#. Run a ``DynamoDBLocal.jar`` process.
#. Stop ``DynamoDBLocal.jar`` process after tests.
Process fixture for DynamoDB.
It starts DynamoDB when first used and stops it at the end
of the tests. Works on ``DynamoDBLocal.jar``.
:param FixtureRequest request: fixture request object
:rtype: pytest_dbfixtures.executors.TCPExecutor
:returns: tcp executor
"""
config = get_config(request)
path_dynamodb_jar = Path(dynamodb_dir or config['dir']) / 'DynamoDBLocal.jar'
path_dynamodb_jar = Path(
dynamodb_dir or config['dir']
) / 'DynamoDBLocal.jar'

if not path_dynamodb_jar.exists():
raise JarPathException(
Expand Down Expand Up @@ -108,17 +115,16 @@ def dynamodb_proc_fixture(request):

def dynamodb(process_fixture_name):
"""
DynamoDB resource factory.
Fixture factory for DynamoDB resource.
:param str process_fixture_name: name of the process fixture
:rtype: func
:returns: function which makes a connection to DynamoDB
"""

@pytest.fixture
def dynamodb_factory(request):
"""
Connect to the local DynamoDB.
Fixture for DynamoDB resource.
:param FixtureRequest request: fixture request object
:rtype: Subclass of :py:class:`~boto3.resources.base.ServiceResource`
Expand Down
2 changes: 0 additions & 2 deletions src/pytest_dynamodb/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with pytest-dynamodb. If not, see <http://www.gnu.org/licenses/>.
"""Plugin module of pytest-dynamodb."""
from tempfile import gettempdir

from pytest_dynamodb import factories


Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# -*- coding: utf-8 -*-
"""Main test module."""
1 change: 1 addition & 0 deletions tests/test_dynamodb.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Test module for pytest-dynamodb."""
import uuid


Expand Down

0 comments on commit b9d85a4

Please sign in to comment.