Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #38 from flywheel-io/python3
Browse files Browse the repository at this point in the history
Support python3 in addition to python2
  • Loading branch information
ehlertjd authored Jan 15, 2019
2 parents 50b2877 + b5ea79e commit 0f73194
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 7 deletions.
39 changes: 39 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
version: 2
workflows:
version: 2
build-workflow:
jobs:
- build:
filters:
tags:
only: /.*/
- test-python3:
filters:
tags:
only: /.*/

jobs:
build:
Expand Down Expand Up @@ -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
9 changes: 5 additions & 4 deletions examples/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function

import argparse
from os import sys, path, listdir, walk
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion gears/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from generator import *
from .generator import *
3 changes: 2 additions & 1 deletion gears/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import print_function
import argparse
import json
import sys
Expand All @@ -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)))
2 changes: 1 addition & 1 deletion spec/readme.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down

0 comments on commit 0f73194

Please sign in to comment.