Browse Source

Revert "Revert "Switch to stestr""

This reverts commit e56801f2e8.

Change-Id: Icbea5ddd744d1fa65a397fb613731315687f9803
tags/3.1.0
James E. Blair 1 year ago
parent
commit
ef23bd4862
6 changed files with 31 additions and 27 deletions
  1. 7
    0
      .coveragerc
  2. 3
    0
      .stestr.conf
  3. 0
    4
      .testr.conf
  4. 6
    12
      TESTING.rst
  5. 1
    2
      test-requirements.txt
  6. 14
    9
      tox.ini

+ 7
- 0
.coveragerc View File

@@ -0,0 +1,7 @@
1
+[run]
2
+branch = True
3
+source = zuul
4
+omit = tests/*
5
+
6
+[report]
7
+ignore_errors = True

+ 3
- 0
.stestr.conf View File

@@ -0,0 +1,3 @@
1
+[DEFAULT]
2
+test_path=tests/unit
3
+top_dir=./

+ 0
- 4
.testr.conf View File

@@ -1,4 +0,0 @@
1
-[DEFAULT]
2
-test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} OS_LOG_DEFAULTS=${OS_LOG_DEFAULTS:-""} ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tests/unit} $LISTOPT $IDOPTION
3
-test_id_option=--load-list $IDFILE
4
-test_list_option=--list

+ 6
- 12
TESTING.rst View File

@@ -50,6 +50,7 @@ Run The Tests
50 50
 *Navigate to the project's root directory and execute*::
51 51
 
52 52
   tox
53
+
53 54
 Note: completing this command may take a long time (depends on system resources)
54 55
 also, you might not see any output until tox is complete.
55 56
 
@@ -79,21 +80,20 @@ To run individual tests with tox::
79 80
 
80 81
   tox -e <env> -- path.to.module.Class.test
81 82
 
82
-For example, to *run the basic Zuul test*::
83
+For example, to *run a single Zuul test*::
83 84
 
84 85
   tox -e py35 -- tests.unit.test_scheduler.TestScheduler.test_jobs_executed
85 86
 
86 87
 To *run one test in the foreground* (after previously having run tox
87 88
 to set up the virtualenv)::
88 89
 
89
-  . .tox/py35/bin/activate
90
-  python -m testtools.run tests.unit.test_scheduler.TestScheduler.test_jobs_executed
90
+  .tox/py35/bin/stestr run -t tests.unit.test_scheduler.TestScheduler.test_jobs_executed
91 91
 
92 92
 List Failing Tests
93 93
 ------------------
94 94
 
95 95
   .tox/py35/bin/activate
96
-  testr failing --list
96
+  stestr failing --list
97 97
 
98 98
 Hanging Tests
99 99
 -------------
@@ -102,7 +102,7 @@ The following will run each test in turn and print the name of the
102 102
 test as it is run::
103 103
 
104 104
   . .tox/py35/bin/activate
105
-  testr run --subunit | subunit2pyunit
105
+  stestr run
106 106
 
107 107
 You can compare the output of that to::
108 108
 
@@ -111,10 +111,4 @@ You can compare the output of that to::
111 111
 Need More Info?
112 112
 ---------------
113 113
 
114
-More information about testr: https://wiki.openstack.org/wiki/Testr
115
-
116
-More information about nose: https://nose.readthedocs.org/en/latest/
117
-
118
-
119
-More information about testing OpenStack code can be found here:
120
-https://wiki.openstack.org/wiki/Testing
114
+More information about stestr: http://stestr.readthedocs.io/en/latest/

+ 1
- 2
test-requirements.txt View File

@@ -4,8 +4,7 @@ coverage>=3.6
4 4
 sphinx>=1.5.1,<1.6
5 5
 sphinxcontrib-blockdiag>=1.1.0
6 6
 fixtures>=0.3.14
7
-python-subunit
8
-testrepository>=0.0.17
7
+stestr>=1.0.0 # Apache-2.0
9 8
 testtools>=0.9.32
10 9
 sphinxcontrib-programoutput
11 10
 sphinx-autodoc-typehints

+ 14
- 9
tox.ini View File

@@ -7,14 +7,18 @@ envlist = pep8,py35
7 7
 basepython = python3
8 8
 setenv = VIRTUAL_ENV={envdir}
9 9
          OS_TEST_TIMEOUT=150
10
+         OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:1}
11
+         OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:1}
12
+         OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:1}
13
+         OS_LOG_DEFAULTS={env:OS_LOG_DEFAULTS:""}
10 14
 passenv = ZUUL_TEST_ROOT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE OS_LOG_DEFAULTS NODEPOOL_ZK_HOST
11 15
 usedevelop = True
12 16
 install_command = pip install {opts} {packages}
13 17
 whitelist_externals = bash
14 18
 deps = -r{toxinidir}/requirements.txt
15 19
        -r{toxinidir}/test-requirements.txt
16
-commands =
17
-  python setup.py test --slowest --testr-args='{posargs}'
20
+commands = stestr run {posargs}
21
+           stestr slowest
18 22
 
19 23
 [nodeenv]
20 24
 install_command = bash tools/pip.sh {opts} {packages}
@@ -43,8 +47,13 @@ commands =
43 47
 
44 48
 [testenv:cover]
45 49
 install_command = {[nodeenv]install_command}
50
+setenv =
51
+    {[testenv]setenv}
46 52
 commands =
47
-  python setup.py test --coverage
53
+    stestr run {posargs}
54
+    coverage combine
55
+    coverage html -d cover
56
+    coverage xml -o cover/coverage.xml
48 57
 
49 58
 [testenv:docs]
50 59
 commands =
@@ -54,17 +63,13 @@ commands =
54 63
 commands = {posargs}
55 64
 
56 65
 [testenv:nodepool]
57
-setenv =
58
-   OS_TEST_PATH = ./tests/nodepool
59 66
 install_command = {[nodeenv]install_command}
60
-commands = python setup.py test --slowest --testr-args='--concurrency=1 {posargs}'
67
+commands = stestr run --concurrency=1 --test-path ./tests/nodepool {posargs}
61 68
 
62 69
 [testenv:remote]
63
-setenv =
64
-   OS_TEST_PATH = ./tests/remote
70
+commands = stestr run --concurrency=1 --test-path ./tests/remote {posargs}
65 71
 passenv = ZUUL_TEST_ROOT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE OS_LOG_DEFAULTS ZUUL_REMOTE_IPV4 ZUUL_SSH_KEY NODEPOOL_ZK_HOST
66 72
 install_command = {[nodeenv]install_command}
67
-commands = python setup.py test --slowest --testr-args='--concurrency=1 {posargs}'
68 73
 
69 74
 [flake8]
70 75
 # These are ignored intentionally in openstack-infra projects;

Loading…
Cancel
Save