Browse Source

Switch to stestr for unit tests

Moves coverage to a separate test environment and CI job.

Change-Id: I94697ba41afbae194136202dfab349eb0367a125
tags/0.7.0
Dmitry Tantsur 9 months ago
parent
commit
d12d966218
6 changed files with 23 additions and 4 deletions
  1. 1
    1
      .gitignore
  2. 2
    0
      .stestr.conf
  3. 1
    0
      .zuul.yaml
  4. 1
    0
      lower-constraints.txt
  5. 1
    0
      test-requirements.txt
  6. 17
    3
      tox.ini

+ 1
- 1
.gitignore View File

@@ -24,7 +24,7 @@ develop-eggs
24 24
 # Other
25 25
 *.DS_Store
26 26
 .idea
27
-.testrepository
27
+.stestr
28 28
 .tox
29 29
 .venv
30 30
 .*.swp

+ 2
- 0
.stestr.conf View File

@@ -0,0 +1,2 @@
1
+[DEFAULT]
2
+test_path=./metalsmith/test

+ 1
- 0
.zuul.yaml View File

@@ -172,6 +172,7 @@
172 172
       - openstack-python35-jobs
173 173
       - openstack-python36-jobs
174 174
       - openstack-lower-constraints-jobs
175
+      - openstack-cover-jobs
175 176
       - docs-on-readthedocs
176 177
     vars:
177 178
       rtd_webhook_id: '37378'

+ 1
- 0
lower-constraints.txt View File

@@ -54,6 +54,7 @@ requestsexceptions==1.4.0
54 54
 restructuredtext-lint==1.1.3
55 55
 simplejson==3.15.0
56 56
 six==1.10.0
57
+stestr==1.0.0
57 58
 stevedore==1.28.0
58 59
 testtools==2.2.0
59 60
 traceback2==1.4.0

+ 1
- 0
test-requirements.txt View File

@@ -7,5 +7,6 @@ flake8-import-order>=0.13 # LGPLv3
7 7
 fixtures>=3.0.0 # Apache-2.0/BSD
8 8
 hacking>=1.0.0 # Apache-2.0
9 9
 mock>=2.0 # BSD
10
+stestr>=1.0.0 # Apache-2.0
10 11
 testtools>=2.2.0 # MIT
11 12
 Pygments>=2.2.0 # BSD

+ 17
- 3
tox.ini View File

@@ -3,16 +3,30 @@ envlist = py3,py27,pep8
3 3
 
4 4
 [testenv]
5 5
 usedevelop = True
6
+setenv = VIRTUAL_ENV={envdir}
7
+         LANGUAGE=en_US
8
+         LC_ALL=en_US.UTF-8
9
+         PYTHONWARNINGS=default::DeprecationWarning
10
+         PYTHONDONTWRITEBYTECODE=1
6 11
 deps =
7 12
     -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
8 13
     -r{toxinidir}/requirements.txt
9 14
     -r{toxinidir}/test-requirements.txt
10 15
 commands =
11
-    coverage run --branch --include "metalsmith*" -m unittest discover metalsmith.test
12
-    coverage report -m --fail-under 90
13
-setenv = PYTHONDONTWRITEBYTECODE=1
16
+    stestr run {posargs}
14 17
 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
15 18
 
19
+[testenv:cover]
20
+basepython = python3
21
+setenv = {[testenv]setenv}
22
+         PYTHON=coverage run --branch --source metalsmith --parallel-mode
23
+commands =
24
+  coverage erase
25
+  stestr run {posargs}
26
+  coverage combine
27
+  coverage report -m --fail-under 90
28
+  coverage html -d ./cover --omit='*test*'
29
+
16 30
 [testenv:venv]
17 31
 deps =
18 32
     -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}

Loading…
Cancel
Save