From a1fb9a69ae93167295537f4f40f8eb2e2be6e515 Mon Sep 17 00:00:00 2001 From: Sean Hudgston Date: Wed, 2 Oct 2019 14:00:21 -0400 Subject: [PATCH 1/5] Fix installer.sh Upgrade to the latest pip, otherwise the default 9.x version has trouble with escaped @ characters in pip.conf --- installer.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/installer.sh b/installer.sh index 4b15020..32479a7 100644 --- a/installer.sh +++ b/installer.sh @@ -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 -U pip -i https://pypi.python.org/simple + # 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 From ca79ba5348b8c5eaff87be3d5a7af1d2ee068ee2 Mon Sep 17 00:00:00 2001 From: Sean Hudgston Date: Wed, 2 Oct 2019 14:21:41 -0400 Subject: [PATCH 2/5] Update installer.sh Add setuptools upgrade --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 32479a7..8f0a544 100644 --- a/installer.sh +++ b/installer.sh @@ -39,7 +39,7 @@ python -m venv venv # Upgrade to the latest pip, otherwise the default 9.x version has trouble # with escaped @ characters in pip.conf -pip install -U pip -i https://pypi.python.org/simple +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 From 2e706ed8248cb1194bd9493671c2f1b37de26f80 Mon Sep 17 00:00:00 2001 From: Sean Hudgston Date: Fri, 18 Oct 2019 09:27:59 -0400 Subject: [PATCH 3/5] Add pytest to test --mode options (#37) * Set pytest as the default option * Refactor main GitHub: https://github.com/cloudant/service_engineering/issues/365 --- src/cirrus/test.py | 48 ++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/cirrus/test.py b/src/cirrus/test.py index 74dc785..06789bc 100644 --- a/src/cirrus/test.py +++ b/src/cirrus/test.py @@ -21,7 +21,6 @@ def build_parser(argslist): parser = ArgumentParser( description='git cirrus test command' ) - parser.add_argument( '--suite', help=( @@ -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( @@ -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 @@ -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__': From 9d8b5b1667fb275dcf4e7735a57b9d16cfe802b7 Mon Sep 17 00:00:00 2001 From: Sean Hudgston Date: Mon, 21 Oct 2019 09:49:13 -0400 Subject: [PATCH 4/5] Configure for pytest (#38) * Configura cirrus for pytest GitHub: https://github.com/cloudant/service_engineering/issues/365 --- pytest.ini | 4 ++++ requirements.txt | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..8203fca --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +python_files = + *_test.py + *_tests.py diff --git a/requirements.txt b/requirements.txt index 0650d82..9e620ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 @@ -13,5 +13,4 @@ pluggage dockerstache>=0.0.9 requests-toolbelt==0.6.2 tox -wheel - +wheel \ No newline at end of file From 0aca3738896aa2c44de984e7beea9cea5d8fdd20 Mon Sep 17 00:00:00 2001 From: Sean Hudgston Date: Mon, 21 Oct 2019 09:50:36 -0400 Subject: [PATCH 5/5] cirrus release: new release created for release/3.1.1 --- cirrus.conf | 2 +- src/cirrus/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cirrus.conf b/cirrus.conf index 546bc01..cba5c5c 100644 --- a/cirrus.conf +++ b/cirrus.conf @@ -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 diff --git a/src/cirrus/__init__.py b/src/cirrus/__init__.py index 5195a4b..ab7d2a4 100644 --- a/src/cirrus/__init__.py +++ b/src/cirrus/__init__.py @@ -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"