Skip to content

Commit

Permalink
Merge branch 'release/0.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
kdopen committed Jun 5, 2014
2 parents 18413e4 + a84303e commit 363e97f
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 8 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -7,7 +7,6 @@ python:
- "3.3"
- "2.7"
- "2.6"
- "pypy"

# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install:
Expand Down
35 changes: 31 additions & 4 deletions CONTRIBUTING.rst
Expand Up @@ -111,17 +111,44 @@ Before you submit a pull request, check that it meets these guidelines:
#. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
#. The pull request should work for Python 2.6, 2.7, and 3.3.
#. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4.
Check https://travis-ci.org/kdopen/gerritssh
under pull requests for active pull requests or run the ``tox`` command and
make sure that the tests pass for all supported Python versions.

.. note::
``gerritssh`` uses the git-flow branching model. Please request that
your pull-request be merged to the ``develop`` branch, and ensure your
changes are based on the ``develop`` branch.


Tips
----
Testing
-------

To run a subset of tests::

$ py.test test/test_<module>.py
where ``<module>`` is the name of the actual submodule you wish to test.

To run tests on all Python versions::

$ make test-all
or
$ tox

To ensure that you have not introduced any errors which would only show up when
actually communicating with a real Gerrit instance, there are a set of tests
which perform no mocking, and actually 'reach out' to a live instance. If you
have an account with review.openstack.org - and have added your public key -
simply run::

$ make test-all-online
or
$ make test-online

If you have an account on a different Gerrit instance, you can test against it
instead::

$ GSSH_TEST_INSTANCE='gerrit.mysite.com' tox
or
$ GSSH_TEST_INSTANCE-'gerrit.mysite.com' py.test
22 changes: 22 additions & 0 deletions HISTORY.rst
Expand Up @@ -4,6 +4,28 @@
Release Notes
=============

0.1.3 (2014-06-04)
------------------

* Fixes #4 - Unit tests are not sufficient

Added a baseline set of unit tests which perform end-to-end validation
against a live Gerrit instance if GSSH_TEST_INSTANCE is set in the
environment.

* Corrects a bug found in the ssh client disconnect function by the new
tests.

* Adds new and extended make targets to better clean and test the package.

* Updated documentation accordingly, including expanded testing information.

* Removed ``pypi`` from the list of environments used on travis-ci.

The tests all run fine under pypi locally, but something in travis's
pypi environment seems to be broken since they started supporting
Python 3.4.

0.1.2 (2014-06-03)
------------------

Expand Down
20 changes: 19 additions & 1 deletion Makefile
Expand Up @@ -3,9 +3,13 @@
help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "clean - Includes clean-build and clean-pyc"
@echo "clean-dist - Includes 'make clean' but also wipes the .tox directory and all eggs"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "test-online - Same as 'make test' but includes online checks"
@echo "test-all - run tests on every Python version with tox"
@echo "test-all-online - Same as 'make test-all' but includes online checks"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
Expand All @@ -16,25 +20,39 @@ clean: clean-build clean-pyc
clean-build:
rm -fr build/
rm -fr docs/build/
rm -fr docs/_build/
rm -fr dist/
rm -fr *.egg-info
rm -fr htmlcov/
rm -fr .coverage
make -C docs clean

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -rf {} +

clean-sdist: clean
rm -rf .tox/
find . -name '*.egg' -exec rm -f {} +

lint:
flake8 gerritssh test

test:
py.test
py.test -l

test-online:
GSSH_TEST_INSTANCE='review.openstack.org' py.test -l


test-all:
tox

test-all-online:
GSSH_TEST_INSTANCE='review.openstack.org' tox

coverage:
coverage run --source gerritssh setup.py test
coverage report -m
Expand Down
2 changes: 1 addition & 1 deletion gerritssh/METADATA
@@ -1,5 +1,5 @@
{
"author" : "Keith Derrick",
"email" : "kderrick_public@att.net",
"version" : "0.1.2"
"version" : "0.1.3"
}
2 changes: 1 addition & 1 deletion gerritssh/borrowed/ssh.py
Expand Up @@ -224,7 +224,7 @@ def disconnect(self):
self.lock.acquire()

try:
if self.connected():
if self.connected:
self.close()
self.__connected.clear()
finally:
Expand Down
53 changes: 53 additions & 0 deletions test/test_online.py
@@ -0,0 +1,53 @@
import pytest
import os

import gerritssh as gssh
import logging

logging.basicConfig(level=logging.CRITICAL)


def online_instance():
return os.getenv('GSSH_TEST_INSTANCE', '')


pytestmark = pytest.mark.skipif(online_instance() == '',
reason=('No live Gerrit instance '
'in environment'))


@pytest.fixture(scope='session')
def live_instance(request):
s = gssh.Site(online_instance())

def fin():
print('Closing connection to ' + online_instance())
s.disconnect()

print('Site created: ' + repr(s))
request.addfinalizer(fin)
s.connect()
assert s.connected
return s


def test_ol_version(live_instance):
assert str(live_instance.version) != '0.0.0'


def test_ol_lp(live_instance):
lp = gssh.ProjectList()
lp.execute_on(live_instance)

assert len(lp.results) > 0


def test_ol_query(live_instance):
log = logging.getLogger('test_ol_query')
log.setLevel(logging.DEBUG)
log.debug('Launching Query')
q = gssh.Query(query='status:open', max_results=3)
qresults = q.execute_on(live_instance)
log.debug('Query Done {0}'.format(qresults))
assert qresults != []
assert len(qresults) <= 3

0 comments on commit 363e97f

Please sign in to comment.