From 9c7ca604f8ee57546e139caaf432aacee02ec9fd Mon Sep 17 00:00:00 2001 From: Andrew Suderman Date: Wed, 26 Jun 2019 12:28:47 -0600 Subject: [PATCH] Deprecating Python2 and requiring ~=3.6 (#110) * Deprecating Python2 and requiring ~=3.6 Also in this: Adding codecov badge. Removed call to codecov on python 3.6 build. Only need to run codecov script once. * Added tests to cover false positive coverage Python 2: str == bytes Python 3: str \!= bytes Therefore there was some broken coverage number. This test actually runs a command via the test and assures proper output for python3. --- .circleci/config.yml | 30 +------------------ CHANGELOG.md | 4 +++ CONTRIBUTING.md | 2 ++ README.md | 11 ++----- .../tests/test_command_line_caller.py | 23 ++++++++++++++ setup.py | 1 + 6 files changed, 34 insertions(+), 37 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 52d4a603..524b5f51 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,9 +15,6 @@ version: 2.1 executors: - python-2-7: - docker: - - image: circleci/python:2.7 python-3-6: docker: - image: circleci/python:3.6 @@ -32,22 +29,6 @@ executors: xcode: 10.2.0 jobs: - build-2-7: - executor: python-2-7 - working_directory: ~/reckoner - steps: - - run: - name: Setup PATH to support pip user installs - command: echo 'export PATH=$PATH:/home/circleci/.local/bin' >> $BASH_ENV - - checkout - - run: - name: Unit Tests - command: | - pip install --user -r development-requirements.txt - pip install --user -e . - reckoner --version - pytest --cov ./ - codecov build-3-6: executor: python-3-6 working_directory: ~/reckoner @@ -62,8 +43,7 @@ jobs: pip install --user -r development-requirements.txt pip install --user -e . reckoner --version - pytest --cov ./ - codecov + pytest build-3-7: executor: python-3-7 working_directory: ~/reckoner @@ -265,12 +245,6 @@ workflows: version: 2 build: jobs: - - build-2-7: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - build-3-6: filters: tags: @@ -285,7 +259,6 @@ workflows: only: /.*/ - compile-darwin: requires: - - build-2-7 - build-3-6 - build-3-7 filters: @@ -295,7 +268,6 @@ workflows: only: /.*/ - compile: requires: - - build-2-7 - build-3-6 - build-3-7 filters: diff --git a/CHANGELOG.md b/CHANGELOG.md index 86721316..99777e2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.3.0] +### Breaking Changes +Python2 support is now ended. Pip install will now require python ~= 3.6. In any case, use of the binary release is recommended. + ## [1.2.0] - Support helm wrapper plugins such as [Helm Secrets](https://github.com/futuresimple/helm-secrets) - POTENTIAL BREAKING CHANGE: Refactored all helm commands to use `--arg value` instead of `--arg=value`. (This helps with poor param support with how helm plugin wrappers work) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 60c9ed45..0d257b8b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,6 +16,8 @@ Requirements ``` Note that some of the above commands may need `python3` instead of just `python` to work depending on your environment. +*Note:* Python2 is no longer supported by this tool + ## Requirements for Pull Requests * Update the changelog * Run tests diff --git a/README.md b/README.md index d31b1789..902db2e6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ - -# reckoner [![CircleCI](https://circleci.com/gh/reactiveops/reckoner.svg?style=svg)](https://circleci.com/gh/reactiveops/reckoner) +# reckoner [![CircleCI](https://circleci.com/gh/reactiveops/reckoner.svg?style=svg)](https://circleci.com/gh/reactiveops/reckoner) [![codecov](https://codecov.io/gh/reactiveops/reckoner/branch/master/graph/badge.svg)](https://codecov.io/gh/reactiveops/reckoner) Command line helper for helm. This utility adds to the functionality of [Helm](https://github.com/kubernetes/helm) in multiple ways: @@ -12,6 +11,8 @@ This utility adds to the functionality of [Helm](https://github.com/kubernetes/h - python 3 - helm: installed and initialized +*Note:* Python2 is no longer supported by Reckoner. In general we suggest using the binary on the [Releases](https://github.com/reactiveops/reckoner/releases) page. + ### Installation Via Binary: *preferred method* * Binary downloads of Reckoner client can be found on the [Releases](https://github.com/reactiveops/reckoner/releases) page. @@ -52,12 +53,6 @@ For development see [CONTRIBUTING.md](./CONTRIBUTING.md). * `generate`: Generates example file `course.yml` with extensive descriptions * `version`: Output reckoner version -## Example configuration file: - -There is an example file in reckoner/example-course.yml - -Further customization is documented below. - # Options ## Global Options diff --git a/reckoner/command_line_caller/tests/test_command_line_caller.py b/reckoner/command_line_caller/tests/test_command_line_caller.py index 45ddf5ab..3c9cc11e 100644 --- a/reckoner/command_line_caller/tests/test_command_line_caller.py +++ b/reckoner/command_line_caller/tests/test_command_line_caller.py @@ -14,6 +14,7 @@ import unittest from reckoner.command_line_caller import Response +from reckoner.command_line_caller import call class TestResponse(unittest.TestCase): @@ -34,3 +35,25 @@ def test_bool(self): response = Response('', '', 0, '') self.assertTrue(response, "All responses with exitcode 0 should return True") + + def test_support_comparisons(self): + resp_one = Response('', '', 0, '') + resp_two = Response('', '', 0, '') + resp_three = Response('', '', 0, 'notequal') + + self.assertEqual(resp_one, resp_two) + self.assertNotEqual(resp_one, resp_three) + self.assertNotEqual(resp_two, resp_three) + + def test_support_str(self): + resp = Response('', '', 0, '') + self.assertEqual(resp.__str__(), "{'stdout': '', 'stderr': '', 'exitcode': 0, 'command_string': ''}") + + +class TestCall(unittest.TestCase): + def test_call_command(self): + """Call whoami and expect an output""" + p = call('whoami', shell=False, executable=None, path=None) + self.assertIsInstance(p, Response) + self.assertIsInstance(p.stdout, str) + self.assertIsInstance(p.stderr, str) diff --git a/setup.py b/setup.py index 458146fa..9fdd238f 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ setup(name='reckoner', + python_requires='~=3.6', use_scm_version=True, setup_requires=['setuptools_scm'], description='Declarative Helm configuration with Git capability',