forked from alisw/alibuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
120 lines (107 loc) · 6.16 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
[tox]
minversion = 3.20
envlist = lint, py{27, 36, 37, 38, 39, 310, 311}
[gh-actions]
# The "lint" job is run separately.
python =
2.7: py27
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
[testenv:lint]
# Warning: This environment inherits settings from the main [testenv] section.
description = run code linters
basepython = python3
allowlist_externals =
find
deps =
flake8
pylint
changedir = {toxinidir}
commands =
# stop the build if there are Python syntax errors or undefined names
flake8 . --config {toxinidir}/.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --config {toxinidir}/.flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
#find . -name .git -prune -false -o -name .tox -prune -false -o -iname '*.py' \
# -exec pylint -j 0 --rcfile {toxinidir}/.pylintrc \{\} +
#pylint -j 0 --rcfile .pylintrc aliBuild aliDeps aliDoctor pb
[testenv]
description = run test suite under {envname}
# Commands we can call that aren't installed in the tox virtualenv.
allowlist_externals =
sh
git
test
touch
deps =
py27: mock
coverage
distro
setenv =
# `aliBuild analytics` puts preference files under $HOME.
HOME = {envtmpdir}
# On Python2, dictionary order depends on PYTHONHASHSEED, but we dump plain
# dictionaries (not OrderedDicts!) straight into the package hashing
# algorithm. Therefore, disable tox's hash seed randomisation on py27 to
# ensure our dicts always have the same order. See also:
# https://tox.wiki/en/latest/example/basic.html#special-handling-of-pythonhashseed
py27: PYTHONHASHSEED = 0
# Keep coverage info for later upload, if needed. Files in {envtmpdir} are
# deleted after each run.
COVERAGE_FILE = {toxworkdir}/coverage.{envname}
changedir = {envtmpdir}
commands =
# The first coverage command shouldn't have an -a, so we completely replace
# the coverage info from the last run.
coverage run --source={toxinidir} {toxinidir}/aliBuild analytics off
test -e .config/alibuild/disable-analytics
test ! -e .config/alibuild/analytics-uuid
coverage run --source={toxinidir} -a {toxinidir}/aliBuild analytics on
test ! -e .config/alibuild/disable-analytics
test -e .config/alibuild/analytics-uuid
coverage run --source={toxinidir} -a {toxinidir}/aliBuild analytics off
test -e .config/alibuild/disable-analytics
test -e .config/alibuild/analytics-uuid
coverage run --source={toxinidir} -a {toxinidir}/aliBuild version
coverage run --source={toxinidir} -a -m unittest discover {toxinidir}/tests
git clone -b O2-v1.3.0 --depth 1 https://github.com/alisw/alidist
coverage run --source={toxinidir} -a {toxinidir}/aliBuild -a slc7_x86-64 -z test-init init zlib
# This command is expected to fail, but run it for the coverage anyway.
# A leading "-" means tox ignores the exit code.
- coverage run --source={toxinidir} -a {toxinidir}/aliBuild build non-existing -a slc7_x86-64 --no-system --disable GCC-Toolchain
# TODO: do we need these? This seems to be at least partially covered by
# unit tests in tests/tests_parseRecipe.py.
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build broken1 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Header missing"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build broken2 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Empty recipe"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build broken3 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Unable to parse"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build broken4 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Malformed header"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build broken5 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Missing package"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build broken6 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "while scanning a quoted scalar"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/aliBuild -c {toxinidir}/tests/testdist build broken7 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Malformed entry prefer_system"'
coverage run --source={toxinidir} -a {toxinidir}/aliBuild build zlib -a slc7_x86-64 --no-system --disable GCC-Toolchain
alienv -a slc7_x86-64 q
alienv -a slc7_x86-64 setenv zlib/latest -c bash -c '[[ $LD_LIBRARY_PATH == */zlib/* ]]'
coverage run --source={toxinidir} -a {toxinidir}/aliBuild -a slc7_x86-64 doctor AliPhysics
coverage run --source={toxinidir} -a {toxinidir}/aliBuild -a slc7_x86-64 build zlib --dry-run
coverage run --source={toxinidir} -a {toxinidir}/aliBuild --aggressive-cleanup --docker -a slc7_x86-64 --always-prefer-system -d build zlib
# Test for devel packages
coverage run --source={toxinidir} -a {toxinidir}/aliBuild init zlib
coverage run --source={toxinidir} -a {toxinidir}/aliBuild --aggressive-cleanup --docker -a slc7_x86-64 --always-prefer-system -d build zlib
# Test that we complain if we have a devel package with an untracked file
touch zlib/foo
coverage run --source={toxinidir} -a {toxinidir}/aliBuild --aggressive-cleanup --docker -a slc7_x86-64 --always-prefer-system -d build zlib
[coverage:run]
branch = True
omit =
*/.tox/*/lib/*
[coverage:report]
exclude_lines =
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.: