Skip to content

Commit

Permalink
Merge branch 'release/3.1.1' into new-master
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hudgston committed Oct 21, 2019
2 parents f39e227 + 0aca373 commit 982beab
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cirrus.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = cirrus-cli
version = 3.1.0
version = 3.1.1
description = cirrus development and build git extensions
organization = cloudant
version_file = src/cirrus/__init__.py
Expand Down
4 changes: 4 additions & 0 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ cd ${LOCATION}
python -m venv venv
. venv/bin/activate

# Upgrade to the latest pip, otherwise the default 9.x version has trouble
# with escaped @ characters in pip.conf
pip install -i https://pypi.python.org/simple -U pip setuptools

# This depends on a properly configured pip.conf file.
# See https://github.com/cloudant/service_engineering/wiki/Using-JFrog-Artifactory
pip install cirrus-cli${CIRRUS_INSTALL_VERSION} 1>> ${LOCATION}/install.log
Expand Down
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
python_files =
*_test.py
*_tests.py
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ argparse==1.2.1
arrow==0.4.2
Fabric==2.4.0
GitPython==2.1.9
nose==1.3.0
pep8==1.5.7
pylint==1.3.0
pytest
requests==2.3.0
PyChef==0.2.3
keyring==8.5.1
Expand All @@ -13,5 +13,4 @@ pluggage
dockerstache>=0.0.9
requests-toolbelt==0.6.2
tox
wheel

wheel
2 changes: 1 addition & 1 deletion src/cirrus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
__version__="3.1.0"
__version__="3.1.1"

48 changes: 31 additions & 17 deletions src/cirrus/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def build_parser(argslist):
parser = ArgumentParser(
description='git cirrus test command'
)

parser.add_argument(
'--suite',
help=(
Expand All @@ -32,8 +31,8 @@ def build_parser(argslist):
)
parser.add_argument(
'--mode',
choices=['nosetests', 'tox'],
default=None,
choices=['nosetests', 'pytest', 'tox'],
default='pytest',
help='Choose test runner framework'
)
parser.add_argument(
Expand Down Expand Up @@ -62,6 +61,21 @@ def nose_run(config, opts):
)


def pytest_run(config, opts):
"""
Locally activate virtualenv and run tests with pytest
"""
testpath = config.test_where(opts.suite)
command = (
'. ./{}/bin/activate && pytest {} {}'.format(
config.venv_name(),
testpath,
opts.options
)
)
run(command, pty=True) # pty preserves pytest colors


def tox_run(config, opts):
"""
tox test
Expand All @@ -85,20 +99,20 @@ def main():
"""
opts = build_parser(sys.argv[1:])
config = load_configuration()
mode = config.test_mode(opts.suite)
if opts.mode:
mode = opts.mode

# backwards compat: default to nosetests
if mode is None:
mode = 'nosetests'

if mode == 'nosetests':
nose_run(config, opts)
sys.exit(0)
if mode == 'tox':
tox_run(config, opts)
sys.exit(0)
testrunners = {
'nosetest': nose_run,
'pytest': pytest_run,
'tox': tox_run
}

try:
testrunner = testrunners[opts.mode]
except KeyError as ex:
# argpase will catch this first, but just in case...
sys.exit("Invalid selection for --mode: {}".format(ex))

testrunner(config, opts)
sys.exit(0)


if __name__ == '__main__':
Expand Down

0 comments on commit 982beab

Please sign in to comment.