Skip to content

Commit 869734a

Browse files
added nose task
1 parent db608bf commit 869734a

File tree

3 files changed

+50
-8
lines changed

3 files changed

+50
-8
lines changed

tekton/pipeline.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#
2-
# This pipeline needs the following tasks from Tekton Hub
3-
# - git-clone
4-
# - flake8
5-
#
6-
---
71
apiVersion: tekton.dev/v1beta1
82
kind: Pipeline
93
metadata:
@@ -36,3 +30,17 @@ spec:
3630
value: $(params.branch)
3731
runAfter:
3832
- init
33+
34+
- name: lint
35+
workspaces:
36+
- name: source
37+
workspace: pipeline-workspace
38+
taskRef:
39+
name: flake8
40+
params:
41+
- name: image
42+
value: "python:3.9-slim"
43+
- name: args
44+
value: ["--count","--max-complexity=10","--max-line-length=127","--statistics"]
45+
runAfter:
46+
- clone

tekton/tasks.yaml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
apiVersion: tekton.dev/v1beta1
32
kind: Task
43
metadata:
@@ -49,4 +48,38 @@ spec:
4948
# Delete files and directories starting with .. plus any other character
5049
rm -rf "${WORKSPACE_SOURCE_PATH}"/..?*
5150
fi
51+
---
52+
apiVersion: tekton.dev/v1beta1
53+
kind: Task
54+
metadata:
55+
name: nose
56+
spec:
57+
description: This task will run nosetests on the provided input.
58+
workspaces:
59+
- name: source
60+
params:
61+
- name: args
62+
description: Arguments to pass to nose
63+
type: string
64+
default: "-v"
65+
- name: database_uri
66+
description: Database connection string
67+
type: string
68+
default: "sqlite:///test.db"
69+
steps:
70+
- name: nosetests
71+
image: python:3.9-slim
72+
workingDir: $(workspaces.source.path)
73+
env:
74+
- name: DATABASE_URI
75+
value: $(params.database_uri)
76+
script: |
77+
#!/bin/bash
78+
set -e
79+
80+
echo "***** Installing dependencies *****"
81+
python -m pip install --upgrade pip wheel
82+
pip install -qr requirements.txt
5283
84+
echo "***** Running nosetests with: $(params.args)"
85+
nosetests $(params.args)

tests/test_routes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,5 @@ def test_cors_security(self):
192192
response = self.client.get('/', environ_overrides=HTTPS_ENVIRON)
193193
self.assertEqual(response.status_code, status.HTTP_200_OK)
194194
# Check for the CORS header
195-
self.assertEqual(response.headers.get('Access-Control-Allow-Origin'), '*')
195+
self.assertEqual(response.headers.get('Access-Control-Allow-Origin'), '*')
196+

0 commit comments

Comments
 (0)