Merge lp:~sbaldassin/snappy-ecosystem-tests/ecosystem_unit_tests into lp:snappy-ecosystem-tests

Proposed by Santiago Baldassin
Status: Merged
Approved by: Heber Parrucci
Approved revision: 17
Merged at revision: 13
Proposed branch: lp:~sbaldassin/snappy-ecosystem-tests/ecosystem_unit_tests
Merge into: lp:snappy-ecosystem-tests
Diff against target: 157 lines (+100/-22)
5 files modified
pylint.cfg (+1/-1)
requirements-unit-tests.txt (+1/-0)
requirements.txt (+1/-0)
run_checks (+68/-21)
snappy_ecosystem_tests/unittests/test_snapcraft.py (+29/-0)
To merge this branch: bzr merge lp:~sbaldassin/snappy-ecosystem-tests/ecosystem_unit_tests
Reviewer Review Type Date Requested Status
platform-qa-bot continuous-integration Approve
Heber Parrucci (community) Approve
Review via email: mp+316998@code.launchpad.net

Commit message

Adding unit tests

Description of the change

Adding a unit tests mechanism

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Heber Parrucci (heber013) wrote :

Looks good to me. Let's land it to adapt other branches to the new check mechanism

review: Approve
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pylint.cfg'
2--- pylint.cfg 2017-02-07 17:41:23 +0000
3+++ pylint.cfg 2017-02-10 20:22:49 +0000
4@@ -82,7 +82,7 @@
5 files-output=no
6
7 # Tells whether to display a full report or only the messages
8-reports=yes
9+reports=no
10
11 # Python expression which should return a note less than 10 (10 is the highest
12 # note). You have access to the variables errors warning, statement which
13
14=== added file 'requirements-unit-tests.txt'
15--- requirements-unit-tests.txt 1970-01-01 00:00:00 +0000
16+++ requirements-unit-tests.txt 2017-02-10 20:22:49 +0000
17@@ -0,0 +1,1 @@
18+unittest2
19
20=== modified file 'requirements.txt'
21--- requirements.txt 2017-02-07 17:41:23 +0000
22+++ requirements.txt 2017-02-10 20:22:49 +0000
23@@ -1,2 +1,3 @@
24 pexpect
25 selenium
26+unittest2
27
28=== renamed file 'run_pylint' => 'run_checks'
29--- run_pylint 2017-02-07 19:24:53 +0000
30+++ run_checks 2017-02-10 20:22:49 +0000
31@@ -1,22 +1,69 @@
32 #!/bin/bash
33-
34-virtualenv -p python3 ve_pylint
35-. ve_pylint/bin/activate
36-
37-proxy=$1
38-if [ "$proxy" ]; then
39- echo "Using proxy: $proxy to install dependencies"
40- pip install --proxy $proxy pylint
41- pip install --proxy $proxy -r requirements.txt
42-else
43- pip install pylint
44- pip install -r requirements.txt
45-fi
46-
47-ve_pylint/bin/python3 -m pylint snappy_ecosystem_tests --reports=y --rcfile=pylint.cfg > pylint-results.txt
48-
49-result=$?
50-
51-deactivate
52-
53-if [ $result != 0 ] && [ $result != 4 ]; then exit 1; fi
54+RED='\033[0;31m'
55+GREEN='\033[0;32m'
56+
57+case "${1:-all}" in
58+ --all)
59+ STATIC=1
60+ UNIT=1
61+ ;;
62+ --static)
63+ STATIC=1
64+ ;;
65+ --unit)
66+ UNIT=1
67+ ;;
68+ *)
69+ echo "Wrong flag ${1}. To run a single suite use --static, --unit"
70+ exit 1
71+esac
72+
73+if [ "$STATIC" = 1 ]; then
74+ virtualenv -p python3 ve_pylint
75+ . ve_pylint/bin/activate
76+
77+ proxy=$2
78+ if [ "$proxy" ]; then
79+ echo "Using proxy: $proxy to install dependencies"
80+ pip install --proxy $proxy pylint
81+ pip install --proxy $proxy -r requirements.txt
82+ else
83+ pip install pylint
84+ pip install -r requirements.txt
85+ fi
86+
87+ ve_pylint/bin/python3 -m pylint snappy_ecosystem_tests --reports=n --rcfile=pylint.cfg > pylint-results.txt
88+
89+ result=$?
90+ if [ $result != 0 ] && [ $result != 4 ]; then
91+ echo -e -n "${RED}Pylint errors. Check pylint output for more information\n"
92+ exit 1;
93+ else
94+ echo -e -n "${GREEN}Congratulations!!! Static check PASSED\n"
95+ fi
96+ deactivate
97+fi
98+
99+if [ "$UNIT" = 1 ]; then
100+ virtualenv -p python3 ve_unit_tests
101+ . ve_unit_tests/bin/activate
102+
103+ if [ "$proxy" ]; then
104+ echo "Using proxy: $proxy to install dependencies"
105+ pip install --proxy $proxy -r requirements-unit-tests.txt
106+ else
107+ pip install -r requirements-unit-tests.txt
108+ fi
109+
110+ ve_unit_tests/bin/python3 -m unittest discover snappy_ecosystem_tests.unittests
111+
112+ result=$?
113+ deactivate
114+
115+ if [ $result != 0 ]; then
116+ echo -e -n "${RED}Unit tests failed.\n"
117+ exit 1;
118+ else
119+ echo -e -n "${GREEN}Congratulations!!! Unit tests PASSED\n"
120+ fi
121+fi
122
123=== added directory 'snappy_ecosystem_tests/unittests'
124=== added file 'snappy_ecosystem_tests/unittests/__init__.py'
125=== added file 'snappy_ecosystem_tests/unittests/test_snapcraft.py'
126--- snappy_ecosystem_tests/unittests/test_snapcraft.py 1970-01-01 00:00:00 +0000
127+++ snappy_ecosystem_tests/unittests/test_snapcraft.py 2017-02-10 20:22:49 +0000
128@@ -0,0 +1,29 @@
129+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
130+
131+#
132+# Snappy Ecosystem Tests
133+# Copyright (C) 2017 Canonical
134+#
135+# This program is free software: you can redistribute it and/or modify
136+# it under the terms of the GNU General Public License as published by
137+# the Free Software Foundation, either version 3 of the License, or
138+# (at your option) any later version.
139+#
140+# This program is distributed in the hope that it will be useful,
141+# but WITHOUT ANY WARRANTY; without even the implied warranty of
142+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
143+# GNU General Public License for more details.
144+#
145+# You should have received a copy of the GNU General Public License
146+# along with this program. If not, see <http://www.gnu.org/licenses/>.
147+#
148+
149+"""Unit tests cases for snapcraft"""
150+
151+from unittest2 import TestCase
152+
153+class SnapcraftTestCase(TestCase):
154+
155+ def test_snapcraft_dummy_test(self):
156+ """Dummy test case"""
157+ self.assertTrue(True)

Subscribers

People subscribed via source and target branches

to all changes: