Skip to content

Commit 983f63f

Browse files
authored
Switch test runner from nosetest to pytest (#6291)
2 parents b62e82e + c4dc652 commit 983f63f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+573
-627
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ jobs:
154154
name: Download st2-packages repository
155155
command: |
156156
set -x
157+
PIP_VERSION=$(grep ^PIP_VERSION Makefile)
157158
git clone ${ST2_PACKAGES_REPO} ~/st2-packages
158159
cd ~/st2-packages
159160
git checkout ${CIRCLE_BRANCH} || true
161+
sed -i -e "s/^PIP_VERSION .*$/${PIP_VERSION}/" packages/st2/debian/rules
160162
- run:
161163
name: Initialize packages Build Environment
162164
command: |

.github/workflows/ci.yaml

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -258,34 +258,29 @@ jobs:
258258
include:
259259
- name: 'Unit Tests (chunk 1)'
260260
task: 'ci-unit'
261-
nosetests_node_total: 2
262-
nosetests_node_index: 0
261+
shard: {k: 0, n: 2}
263262
python-version-short: '3.8'
264263
python-version: '3.8.10'
265264
- name: 'Unit Tests (chunk 2)'
266265
task: 'ci-unit'
267-
nosetests_node_total: 2
268-
nosetests_node_index: 1
266+
shard: {k: 1, n: 2}
269267
python-version-short: '3.8'
270268
python-version: '3.8.10'
271269
- name: 'Unit Tests (chunk 1)'
272270
task: 'ci-unit'
273-
nosetests_node_total: 2
274-
nosetests_node_index: 0
271+
shard: {k: 0, n: 2}
275272
python-version-short: '3.9'
276273
python-version: '3.9.14'
277274
- name: 'Unit Tests (chunk 2)'
278275
task: 'ci-unit'
279-
nosetests_node_total: 2
280-
nosetests_node_index: 1
276+
shard: {k: 1, n: 2}
281277
python-version-short: '3.9'
282278
python-version: '3.9.14'
283279
# This job is slow so we only run in on a daily basis
284280
# - name: 'Micro Benchmarks'
285281
# task: 'micro-benchmarks'
286282
# python-version: '3.6.13'
287-
# nosetests_node_total: 1
288-
# nosetests_node_ index: 0
283+
# shard: {k: 0, n: 1}
289284
services:
290285
mongo:
291286
image: mongo:7.0
@@ -317,8 +312,8 @@ jobs:
317312
env:
318313
TASK: '${{ matrix.task }}'
319314
PYTHON_VERSION_SHORT: '${{ matrix.python-version-short }}'
320-
NODE_TOTAL: '${{ matrix.nosetests_node_total }}'
321-
NODE_INDEX: '${{ matrix.nosetests_node_index }}'
315+
NODE_TOTAL: '${{ matrix.shard.n }}'
316+
NODE_INDEX: '${{ matrix.shard.k }}'
322317

323318
# We need to explicitly specify terminal width otherwise some CLI tests fail on container
324319
# environments where small terminal size is used.
@@ -417,38 +412,32 @@ jobs:
417412
# up (aka stanley user being present, etc.)
418413
- name: 'Pack Tests'
419414
task: 'ci-packs-tests'
420-
nosetests_node_total: 1
421-
nosetests_node_index: 0
415+
shard: {k: 0, n: 1}
422416
python-version-short: '3.8'
423417
python-version: '3.8.10'
424418
- name: 'Integration Tests (chunk 1)'
425419
task: 'ci-integration'
426-
nosetests_node_total: 2
427-
nosetests_node_index: 0
420+
shard: {k: 0, n: 2}
428421
python-version-short: '3.8'
429422
python-version: '3.8.10'
430423
- name: 'Integration Tests (chunk 2)'
431424
task: 'ci-integration'
432-
nosetests_node_total: 2
433-
nosetests_node_index: 1
425+
shard: {k: 1, n: 2}
434426
python-version-short: '3.8'
435427
python-version: '3.8.10'
436428
- name: 'Pack Tests'
437429
task: 'ci-packs-tests'
438-
nosetests_node_total: 1
439-
nosetests_node_index: 0
430+
shard: {k: 0, n: 1}
440431
python-version-short: '3.9'
441432
python-version: '3.9.14'
442433
- name: 'Integration Tests (chunk 1)'
443434
task: 'ci-integration'
444-
nosetests_node_total: 2
445-
nosetests_node_index: 0
435+
shard: {k: 0, n: 2}
446436
python-version-short: '3.9'
447437
python-version: '3.9.14'
448438
- name: 'Integration Tests (chunk 2)'
449439
task: 'ci-integration'
450-
nosetests_node_total: 2
451-
nosetests_node_index: 1
440+
shard: {k: 1, n: 2}
452441
python-version-short: '3.9'
453442
python-version: '3.9.14'
454443
services:
@@ -504,8 +493,8 @@ jobs:
504493
env:
505494
TASK: '${{ matrix.task }}'
506495
PYTHON_VERSION_SHORT: '${{ matrix.python-version-short }}'
507-
NODE_TOTAL: '${{ matrix.nosetests_node_total }}'
508-
NODE_INDEX: '${{ matrix.nosetests_node_index }}'
496+
NODE_TOTAL: '${{ matrix.shard.n }}'
497+
NODE_INDEX: '${{ matrix.shard.k }}'
509498

510499
# We need to explicitly specify terminal width otherwise some CLI tests fail on container
511500
# environments where small terminal size is used.
@@ -591,7 +580,7 @@ jobs:
591580
if: ${{ failure() && env.TASK == 'ci-integration' }}
592581
uses: actions/upload-artifact@v4
593582
with:
594-
name: logs-py${{ matrix.python-version }}-nose-${{ matrix.nosetests_node_index }}
583+
name: logs-py${{ matrix.python-version }}-pytest-${{ matrix.shard.k }}
595584
path: logs.tar.gz
596585
retention-days: 7
597586

.github/workflows/microbenchmarks.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ jobs:
3636
include:
3737
- name: 'Microbenchmarks'
3838
task: 'micro-benchmarks'
39-
nosetests_node_total: 1
40-
nosetests_node_index: 0
39+
shard: {k: 0, n: 1}
4140
python-version-short: '3.8'
4241
python-version: '3.8.10'
4342
- name: 'Microbenchmarks'
4443
task: 'micro-benchmarks'
45-
nosetests_node_total: 1
46-
nosetests_node_index: 0
44+
shard: {k: 0, n: 1}
4745
python-version-short: '3.9'
4846
python-version: '3.9.14'
4947
services:
@@ -64,8 +62,8 @@ jobs:
6462
env:
6563
TASK: '${{ matrix.task }}'
6664

67-
NODE_TOTAL: '${{ matrix.nosetests_node_total }}'
68-
NODE_INDEX: '${{ matrix.nosetests_node_index }}'
65+
NODE_TOTAL: '${{ matrix.shard.n }}'
66+
NODE_INDEX: '${{ matrix.shard.k }}'
6967

7068
COLUMNS: '120'
7169
ST2_CI: 'true'

.github/workflows/orquesta-integration-tests.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,12 @@ jobs:
5757
include:
5858
- name: 'Integration Tests (Orquesta)'
5959
task: 'ci-orquesta'
60-
nosetests_node_total: 1
61-
nosetests_node_index: 0
60+
shard: {k: 0, n: 1}
6261
python-version-short: '3.8'
6362
python-version: '3.8.10'
6463
- name: 'Integration Tests (Orquesta)'
6564
task: 'ci-orquesta'
66-
nosetests_node_total: 1
67-
nosetests_node_index: 0
65+
shard: {k: 0, n: 1}
6866
python-version-short: '3.9'
6967
python-version: '3.9.14'
7068
services:
@@ -97,8 +95,8 @@ jobs:
9795

9896
env:
9997
TASK: '${{ matrix.task }}'
100-
NODE_TOTAL: '${{ matrix.nosetests_node_total }}'
101-
NODE_INDEX: '${{ matrix.nosetests_node_index }}'
98+
NODE_TOTAL: '${{ matrix.shard.n }}'
99+
NODE_INDEX: '${{ matrix.shard.k }}'
102100

103101
# We need to explicitly specify terminal width otherwise some CLI tests fail on container
104102
# environments where small terminal size is used.

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ Changed
6363
* Relaxed `dnspython` pinning for compatibility with python 3.10 and greater. #6265
6464
Contributed by @nzlosh
6565

66+
* Switched tests from `nosetest` to `pytest`. `st2-run-pack-tests` also uses pytest.
67+
So, all pack tests must be runnable by `pytest`, which may require migration. #6291
68+
Contributed by @nzlosh, @FileMagic, @guzzijones, and @cognifloyd.
69+
6670
Added
6771
~~~~~
6872
* Continue introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)

0 commit comments

Comments
 (0)