Merge lp:~sergiusens/snapcraft/testing-fixes into lp:~snappy-dev/snapcraft/core

Proposed by Sergio Schvezov on 2015-08-26
Status: Merged
Approved by: Leo Arias on 2015-08-28
Approved revision: 151
Merged at revision: 142
Proposed branch: lp:~sergiusens/snapcraft/testing-fixes
Merge into: lp:~snappy-dev/snapcraft/core
Prerequisite: lp:~sergiusens/snapcraft/validation
Diff against target: 91 lines (+27/-5)
4 files modified
.bzrignore (+3/-0)
debian/control (+1/-0)
runtests.sh (+22/-1)
snapcraft/plugins/qml.py (+1/-4)
To merge this branch: bzr merge lp:~sergiusens/snapcraft/testing-fixes
Reviewer Review Type Date Requested Status
Leo Arias 2015-08-26 Approve on 2015-08-26
Review via email: mp+269146@code.launchpad.net

Commit Message

Multiple testing additions

To post a comment you must log in.
Leo Arias (elopio) wrote :

Looks good.

What about:

python3 $(which flake8) $SRC_PATHS --ignore=E501

to run flake8?

review: Approve
Sergio Schvezov (sergiusens) wrote :

> Looks good.
>
> What about:
>
> python3 $(which flake8) $SRC_PATHS --ignore=E501
>
> to run flake8?

It is good, but I still have to install python-flake8 AND python3-flake8 so I get python-mccabe, python-pep8 and pyflakes which is cruft and I don't like that :-P

Zygmunt Krynicki (zyga) wrote :

Just install python3-flake8 and run it via python3 -m

Sergio Schvezov (sergiusens) wrote :

On Wed, Aug 26, 2015 at 7:48 AM, Zygmunt Krynicki <
<email address hidden>> wrote:

> Just install python3-flake8 and run it via python3 -m
>

Great, but now I have the problem that I don't want to fail on mccabe and
just report it to start fixing it

I'll switch to this as soon as the complexity lowers from 22 ;-)

Snappy Tarmac (snappydevtarmac) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2015-07-09 15:44:05 +0000
3+++ .bzrignore 2015-08-27 21:34:59 +0000
4@@ -1,9 +1,12 @@
5 examples/*/parts/
6 examples/*/snap/
7 examples/*/stage/
8+examples/**/*.snap
9 tests/unit/parts/
10 tests/unit/snap/
11 tests/unit/stage/
12 build
13 dist
14 *.egg-info
15+.coverage**
16+htmlcov
17
18=== modified file 'debian/control'
19--- debian/control 2015-08-27 21:34:59 +0000
20+++ debian/control 2015-08-27 21:34:59 +0000
21@@ -15,6 +15,7 @@
22 python3-apt,
23 python3-fixtures,
24 python3-jsonschema,
25+ python3-mccabe
26 python3-setuptools,
27 python3-testscenarios,
28 python3-yaml,
29
30=== modified file 'runtests.sh'
31--- runtests.sh 2015-07-22 14:15:03 +0000
32+++ runtests.sh 2015-08-27 21:34:59 +0000
33@@ -22,12 +22,29 @@
34
35 SRC_PATHS="bin snapcraft snapcraft/tests"
36
37+# These three checks could easily be done with flake8 in one shot if
38+# we had python3-flake8 provide flake8
39 # Ignore 501 (line-too-long)
40 pep8 $SRC_PATHS --ignore=E501
41
42 pyflakes3 $SRC_PATHS
43
44+# mccabe in 'warning' mode as we have high complexity
45+mccabe_list=
46+for unit in $(find . -type f -name '*.py')
47+do
48+ output=$(python3 -m mccabe --min 10 "$unit")
49+ [ -n "$output" ] && mccabe_list="- $unit:\n $output\n$mccabe_list"
50+done
51+
52+if [ -n "$mccabe_list" ]; then
53+ echo -e "\e[1;31mThe project has gotten complex\e[0m."
54+ echo "Here's the list of units exceeding 10:"
55+ echo -e "$mccabe_list"
56+fi
57+
58 if which python3-coverage >/dev/null 2>&1; then
59+ python3-coverage erase
60 python3-coverage run --branch --source snapcraft -m unittest
61 mv .coverage .coverage.unit
62 else
63@@ -90,7 +107,11 @@
64 if which python3-coverage >/dev/null 2>&1; then
65 python3-coverage combine
66 python3-coverage report
67- python3-coverage erase
68+
69+ echo
70+ echo "Run 'python3-coverage html' to get a nice report"
71+ echo "View it by running 'x-www-browser htmlcov'"
72+ echo
73 fi
74
75 echo -e "\e[1;32mEverything passed\e[0m"
76
77=== modified file 'snapcraft/plugins/qml.py'
78--- snapcraft/plugins/qml.py 2015-08-05 15:39:18 +0000
79+++ snapcraft/plugins/qml.py 2015-08-27 21:34:59 +0000
80@@ -76,10 +76,7 @@
81 def build_qt_config(self):
82 arch = snapcraft.common.get_arch_triplet()
83 configdir = os.path.join(self.installdir, 'etc', 'xdg', 'qtchooser')
84- try:
85- os.makedirs(configdir)
86- except FileExistsError:
87- pass
88+ os.makedirs(configdir, exist_ok=True)
89 config = open(os.path.join(configdir, 'snappy-qt5.conf'), 'w')
90 config.write('./usr/lib/{}/qt5/bin\n'.format(arch))
91 config.write('./usr/lib/{}\n'.format(arch))

Subscribers

People subscribed via source and target branches