From b5ea79ec63df9654059df43df6afbd0a6c081a97 Mon Sep 17 00:00:00 2001 From: Justin Ehlert Date: Tue, 15 Jan 2019 12:37:13 -0600 Subject: [PATCH] Support python3 in addition to python2 --- .circleci/config.yml | 39 +++++++++++++++++++++++++++++++++++++++ examples/test.py | 9 +++++---- gears/__init__.py | 2 +- gears/__main__.py | 3 ++- spec/readme.md | 2 +- 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab18f3b..31ddb50 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,16 @@ version: 2 +workflows: + version: 2 + build-workflow: + jobs: + - build: + filters: + tags: + only: /.*/ + - test-python3: + filters: + tags: + only: /.*/ jobs: build: @@ -29,3 +41,30 @@ jobs: - run: name: Exchange litmus test command: .circleci/litmus-test.sh + + test-python3: + docker: + - image: python:3-alpine3.7 + + steps: + - checkout + + - restore_cache: + key: gears-1-{{ checksum "setup.py"}} + + - run: + name: Install Dependencies + command: pip install -e . + + - save_cache: + key: gears-1-{{ checksum "setup.py"}} + paths: + - "~/.cache/pip" + + - run: + name: Validation suite + command: examples/test.py validation + + - run: + name: Exchange litmus test + command: .circleci/litmus-test.sh diff --git a/examples/test.py b/examples/test.py index 905a6fb..5e0f992 100755 --- a/examples/test.py +++ b/examples/test.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import print_function import argparse from os import sys, path, listdir, walk @@ -51,19 +52,19 @@ def run_test_wrap(name, manifest, invocation, shouldpass): try: run_test(name, manifest, invocation) if shouldpass: - print '[X]' + print('[X]') return except jsonschema.exceptions.ValidationError as ex: if shouldpass: - print '[ ]' + print('[ ]') raise ex else: - print '[X]' + print('[X]') return - print '[ ]' + print('[ ]') raise Exception('Test should fail but did not: ' + name) def run_validation_suite(args): diff --git a/gears/__init__.py b/gears/__init__.py index 9acffd0..4f233cb 100644 --- a/gears/__init__.py +++ b/gears/__init__.py @@ -1 +1 @@ -from generator import * +from .generator import * diff --git a/gears/__main__.py b/gears/__main__.py index a24cdd3..44e7261 100644 --- a/gears/__main__.py +++ b/gears/__main__.py @@ -1,3 +1,4 @@ +from __future__ import print_function import argparse import json import sys @@ -12,4 +13,4 @@ manifest = generator.load_json_from_file(args.manifest) -print json.dumps(generator.derive_invocation_schema(manifest)) +print(json.dumps(generator.derive_invocation_schema(manifest))) diff --git a/spec/readme.md b/spec/readme.md index bdd8707..306c61b 100644 --- a/spec/readme.md +++ b/spec/readme.md @@ -1,4 +1,4 @@ -# Flywheel Gear Spec (v0.1.8) +# Flywheel Gear Spec (v0.1.9) This document describes the structure of a Flywheel Gear.