Browse Source

Switch to stestr

According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: Ifd51e726de277d33ff61db47110bf8b5563fcda7
Vu Cong Tuan 9 months ago
parent
commit
944fe4b6c1
8 changed files with 20 additions and 33 deletions
  1. 1
    1
      .gitignore
  2. 4
    0
      .stestr.conf
  3. 0
    7
      .testr.conf
  4. 1
    1
      lower-constraints.txt
  5. 1
    1
      test-requirements.txt
  6. 0
    16
      tools/pretty_tox.sh
  7. 2
    2
      tools/run-pifpaf-tests.sh
  8. 11
    5
      tox.ini

+ 1
- 1
.gitignore View File

@@ -14,7 +14,7 @@ AUTHORS
14 14
 .update-venv/
15 15
 ChangeLog
16 16
 *.egg
17
-.testrepository/
17
+.stestr/
18 18
 .project
19 19
 .pydevproject
20 20
 oslo.db.egg-info/

+ 4
- 0
.stestr.conf View File

@@ -0,0 +1,4 @@
1
+[DEFAULT]
2
+test_path=${OS_TEST_PATH:-oslo_db/tests}
3
+top_dir=./
4
+

+ 0
- 7
.testr.conf View File

@@ -1,7 +0,0 @@
1
-[DEFAULT]
2
-test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
3
-             OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
4
-             OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
5
-             ${PYTHON:-python} -m subunit.run discover -t ./ ./oslo_db/tests $LISTOPT $IDOPTION
6
-test_id_option=--load-list $IDFILE
7
-test_list_option=--list

+ 1
- 1
lower-constraints.txt View File

@@ -58,10 +58,10 @@ smmap==0.9.0
58 58
 SQLAlchemy==1.0.10
59 59
 sqlalchemy-migrate==0.11.0
60 60
 sqlparse==0.2.2
61
-stestr==1.0.0
62 61
 stevedore==1.20.0
63 62
 Tempita==0.5.2
64 63
 testrepository==0.0.18
64
+stestr==2.0.0
65 65
 testresources==2.0.0
66 66
 testscenarios==0.4
67 67
 testtools==2.2.0

+ 1
- 1
test-requirements.txt View File

@@ -9,7 +9,7 @@ mock>=2.0.0 # BSD
9 9
 python-subunit>=1.0.0 # Apache-2.0/BSD
10 10
 oslotest>=3.2.0 # Apache-2.0
11 11
 oslo.context>=2.19.2 # Apache-2.0
12
-testrepository>=0.0.18 # Apache-2.0/BSD
12
+stestr>=2.0.0 # Apache-2.0
13 13
 testtools>=2.2.0 # MIT
14 14
 os-testr>=1.0.0 # Apache-2.0
15 15
 bandit>=1.1.0 # Apache-2.0

+ 0
- 16
tools/pretty_tox.sh View File

@@ -1,16 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# return nonzero exit status of rightmost command, so that we
4
-# get nonzero exit on test failure without halting subunit-trace
5
-set -o pipefail
6
-
7
-
8
-TESTRARGS=$1
9
-
10
-python setup.py testr --testr-args="--subunit $TESTRARGS" | subunit-trace -f
11
-retval=$?
12
-# NOTE(mtreinish) The pipe above would eat the slowest display from pbr's testr
13
-# wrapper so just manually print the slowest tests
14
-echo -e "\nSlowest Tests:\n"
15
-testr slowest
16
-exit $retval

+ 2
- 2
tools/run-pifpaf-tests.sh View File

@@ -3,5 +3,5 @@ set -e
3 3
 # Replace mysql:// by mysql+pymysql:// and add sqlite
4 4
 export OS_TEST_DBAPI_ADMIN_CONNECTION="${OS_TEST_DBAPI_ADMIN_CONNECTION/#mysql:/mysql+pymysql:};sqlite://"
5 5
 echo $OS_TEST_DBAPI_ADMIN_CONNECTION
6
-tools/pretty_tox.sh $*
7
-TEST_EVENTLET=1 tools/pretty_tox.sh $*
6
+stestr run $*
7
+TEST_EVENTLET=1 stestr run $*

+ 11
- 5
tox.ini View File

@@ -8,7 +8,7 @@ whitelist_externals = bash
8 8
                       env
9 9
 setenv =
10 10
    VIRTUAL_ENV={envdir}
11
-   BASECOMMAND=bash tools/pretty_tox.sh
11
+   BASECOMMAND=stestr run
12 12
    BRANCH_NAME=master
13 13
    CLIENT_NAME=oslo.db
14 14
 
@@ -20,15 +20,15 @@ deps =
20 20
     -r{toxinidir}/test-requirements.txt
21 21
     -r{toxinidir}/requirements.txt
22 22
 commands =
23
-  {env:PIFPAF_MYSQL:} {env:PIFPAF_POSTGRESQL:} {env:BASECOMMAND:} '{posargs}'
23
+  {env:PIFPAF_MYSQL:} {env:PIFPAF_POSTGRESQL:} {env:BASECOMMAND:} {posargs}
24 24
 
25 25
 passenv = OS_TEST_DBAPI_ADMIN_CONNECTION
26 26
 
27 27
 [testenv:py27]
28 28
 basepython = python2.7
29 29
 commands =
30
-    env TEST_EVENTLET=0 bash tools/pretty_tox.sh '{posargs}'
31
-    env TEST_EVENTLET=1 bash tools/pretty_tox.sh '{posargs}'
30
+    env TEST_EVENTLET=0 stestr run {posargs}
31
+    env TEST_EVENTLET=1 stestr run {posargs}
32 32
 
33 33
 [testenv:pep8]
34 34
 basepython = python3
@@ -43,7 +43,13 @@ commands = {posargs}
43 43
 
44 44
 [testenv:cover]
45 45
 basepython = python3
46
-commands = python setup.py test --coverage --coverage-package-name=oslo_db --testr-args='{posargs}'
46
+setenv =
47
+    PYTHON=coverage run --source oslo_db --parallel-mode
48
+commands =
49
+    stestr run '{posargs}'
50
+    coverage combine
51
+    coverage html -d cover
52
+    coverage xml -o cover/coverage.xml
47 53
 
48 54
 [testenv:docs]
49 55
 basepython = python3

Loading…
Cancel
Save