aboutsummaryrefslogtreecommitdiffstats
path: root/tox.ini
diff options
context:
space:
mode:
authorArif Ali <arif.ali@canonical.com>2024-01-15 18:51:04 -0800
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-04-12 11:50:48 -0400
commit93bcf51257ec4ce2b97c942e51e56546ce8cd0cd (patch)
treedb1e835f5de49918553281726d86f4660731313e /tox.ini
parent4069af4bca5d20662389200f0d426d2d31f054e8 (diff)
downloadsos-93bcf51257ec4ce2b97c942e51e56546ce8cd0cd.tar.gz
[testing] Add most testing via tox.ini
Consolidate testing, so that things can be run from CLI, CI and various other means in a consistent way by using tox. * Updated all the flake8 tests in the tests folder. * Added pylint as a neutral test so that we can work on this in stages and have some collaboration on what we test and don't * The tox tests for unit, stageone, stagetwo testing makes is easier for users to know how to run tests, and not have to do things manually * Using tox for CI doesn't make sense, as that will create virtual envs and will disregard system/snap based python modules so may not work Signed-off-by: Arif Ali <arif.ali@canonical.com>
Diffstat (limited to 'tox.ini')
-rw-r--r--tox.ini72
1 files changed, 72 insertions, 0 deletions
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 00000000..9d4b16e7
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,72 @@
+[tox]
+envlist = flake8
+
+[testenv]
+deps =
+ -r{toxinidir}/requirements.txt
+ avocado-framework==94.0
+ python_magic
+setenv =
+ PYTHONPATH = {toxinidir}/tests
+
+[testenv:flake8]
+deps = flake8
+commands = flake8 sos tests
+
+[testenv:pylint]
+deps = pylint
+commands = pylint --rcfile=tox.ini sos tests
+
+[testenv:unit_tests]
+basepython = python3
+setenv =
+ PYTHONPATH = .
+commands =
+ avocado run tests/unittests/
+
+[testenv:stageone_tests]
+basepython = python3
+commands =
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stageone tests/cleaner_tests
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stageone tests/collect_tests
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stageone tests/report_tests
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stageone tests/vendor_tests
+
+[testenv:stagetwo_tests]
+basepython = python3
+commands =
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stagetwo tests/cleaner_tests
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stagetwo tests/collect_tests
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stagetwo tests/report_tests
+ avocado run -p TESTLOCAL=true --test-runner=runner -t stagetwo tests/vendor_tests
+
+[testenv:foreman_tests]
+basepython = python3
+commands =
+ avocado run -p TESTLOCAL=true --test-runner=runner -t foreman tests/product_tests/foreman/
+
+[testenv:nosetests]
+basepython = python3
+deps =
+ {[testenv]deps}
+ nose3
+commands =
+ nosetests -v --with-coverage --cover-package=sos tests/unittests --cover-html
+
+[pylint]
+# C0114, # missing-module-docstring
+# C0115, # missing-class-docstring
+# C0116, # missing-function-docstring
+# R0401, # cyclic-import
+# R0801, # duplicate-code
+# R0904, # too-many-public-methods
+disable = all
+enable =
+ C0209, # consider-using-f-string
+ C0411, # wrong-import-order
+ E1101, # no-member
+ R0912, # too-many-branches
+ R0914, # too-many-locals
+ R1725, # super-with-arguments
+ W1404 # implicit-str-concat
+max-line-length = 79