Skip to content

Commit 28a459c

Browse files
authored
Merge pull request #238 from neutrinoceros/drop_nose
TST: migrate from nosetest to pytest
2 parents 494db47 + a496ade commit 28a459c

File tree

13 files changed

+290
-403
lines changed

13 files changed

+290
-403
lines changed

.circleci/config.yml

Lines changed: 18 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ commands:
77
- run:
88
name: "Set environment variables."
99
command: |
10-
echo 'export GOLD_STANDARD=HEAD' >> $BASH_ENV
1110
echo 'export ROCKSTAR_DIR=$HOME/rockstar-galaxies' >> $BASH_ENV
1211
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROCKSTAR_DIR' >> $BASH_ENV
1312
echo 'export YT_DATA=$HOME/yt_test' >> $BASH_ENV
14-
echo 'export TEST_DIR=$HOME/test_results' >> $BASH_ENV
15-
echo 'export TEST_NAME=astro_analysis' >> $BASH_ENV
16-
echo 'export TEST_FLAGS="--nologcapture -v --with-answer-testing --local --local-dir $TEST_DIR --answer-name=$TEST_NAME --answer-big-data"' >> $BASH_ENV
1713
echo 'export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe' >> $BASH_ENV
1814
echo 'export OMPI_MCA_rmaps_base_oversubscribe=true' >> $BASH_ENV
1915
@@ -23,6 +19,7 @@ commands:
2319
- run:
2420
name: "Install dependencies with yt from source."
2521
command: |
22+
set -x
2623
source $BASH_ENV
2724
sudo apt update
2825
sudo apt upgrade
@@ -70,37 +67,17 @@ commands:
7067
name: "Download test data."
7168
no_output_timeout: 20m
7269
command: |
73-
if [ ! -f $YT_DATA/enzo_tiny_cosmology/DD0046/DD0046 ]; then
70+
if [ ! -f $YT_DATA/done ]; then
7471
source $BASH_ENV
7572
source $HOME/venv/bin/activate
7673
mkdir -p $YT_DATA
7774
girder-cli --api-url https://girder.hub.yt/api/v1 download 577c09480d7c6b0001ad5be2 $YT_DATA/enzo_tiny_cosmology
75+
girder-cli --api-url https://girder.hub.yt/api/v1 download 577c046c0d7c6b0001ad53c8 $YT_DATA/Enzo_64
76+
girder-cli --api-url https://girder.hub.yt/api/v1 download 577c1c160d7c6b0001ad71db $YT_DATA/rockstar_halos
77+
touch $YT_DATA/done
7878
fi
7979
80-
build-and-test-nose:
81-
description: "Build yt_astro_analysis and run tests (nose)."
82-
steps:
83-
- run:
84-
name: "Build yt_astro_analysis and run tests."
85-
command: |
86-
# tag the tip so we can get back there
87-
git tag tip
88-
source $BASH_ENV
89-
source $HOME/venv/bin/activate
90-
# generate answers if not cached
91-
if [ ! -f ${TEST_DIR}/${TEST_NAME}/${TEST_NAME} ]; then
92-
git checkout $GOLD_STANDARD
93-
python -m pip install -e .
94-
nosetests $TEST_FLAGS --answer-store
95-
fi
96-
# return to tip and run comparison tests
97-
git checkout tip
98-
python -m pip install -e .
99-
coverage run `which nosetests` $TEST_FLAGS
100-
# code coverage report
101-
codecov
102-
103-
build-and-test-pytest:
80+
build-and-test:
10481
description: "Build yt_astro_analysis and run tests (pytest)."
10582
steps:
10683
- run:
@@ -109,7 +86,7 @@ commands:
10986
source $BASH_ENV
11087
source $HOME/venv/bin/activate
11188
python -m pip install -e .
112-
pytest
89+
pytest --color=yes -ra -s
11390
11491
build-docs:
11592
description: "Test the docs build."
@@ -150,98 +127,31 @@ jobs:
150127

151128
- restore_cache:
152129
name: "Restore dependencies cache."
153-
key: python-<< parameters.tag >>-dependencies-bonxie
130+
key: python-<< parameters.tag >>-dependencies-abbott
154131

155132
- install-with-yt-dev
156133

157134
- save_cache:
158135
name: "Save dependencies cache"
159-
key: python-<< parameters.tag >>-dependencies-bonxie
136+
key: python-<< parameters.tag >>-dependencies-abbott
160137
paths:
161138
- ~/.cache/pip
162139
- ~/venv
163-
- ~/yt-git
164140
- ~/rockstar-galaxies
165141

166142
- restore_cache:
167143
name: "Restore test data cache."
168-
key: test-data-bonxie
144+
key: test-data-aardsma
169145

170146
- download-test-data
171147

172148
- save_cache:
173149
name: "Save test data cache."
174-
key: test-data-bonxie
150+
key: test-data-aardsma
175151
paths:
176152
- ~/yt_test
177153

178-
- restore_cache:
179-
name: "Restore test answers."
180-
key: python-<< parameters.tag >>-test-answers-bonxie
181-
182-
- build-and-test-nose
183-
184-
- save_cache:
185-
name: "Save test answers cache."
186-
key: python-<< parameters.tag >>-test-answers-bonxie
187-
paths:
188-
- ~/test_results
189-
190-
run-tests-pytest:
191-
# Run a subset of the test suite (yield-based tests are not supported by pytest)
192-
# this is necessary to test in Python 3.10+ because it's not compatible with nose
193-
parameters:
194-
tag:
195-
type: string
196-
default: latest
197-
executor:
198-
name: python
199-
tag: << parameters.tag >>
200-
201-
working_directory: ~/yt_astro_analysis
202-
203-
steps:
204-
- checkout
205-
- set-env
206-
207-
- restore_cache:
208-
name: "Restore dependencies cache."
209-
key: python-<< parameters.tag >>-dependencies-bonxie
210-
211-
- install-with-yt-dev
212-
213-
- save_cache:
214-
name: "Save dependencies cache"
215-
key: python-<< parameters.tag >>-dependencies-bonxie
216-
paths:
217-
- ~/.cache/pip
218-
- ~/venv
219-
- ~/yt-git
220-
- ~/rockstar-galaxies
221-
222-
- restore_cache:
223-
name: "Restore test data cache."
224-
key: test-data-bonxie
225-
226-
- download-test-data
227-
228-
- save_cache:
229-
name: "Save test data cache."
230-
key: test-data-bonxie
231-
paths:
232-
- ~/yt_test
233-
234-
- restore_cache:
235-
name: "Restore test answers."
236-
key: python-<< parameters.tag >>-test-answers-bonxie-pytest
237-
238-
- build-and-test-pytest
239-
240-
- save_cache:
241-
name: "Save test answers cache."
242-
key: python-<< parameters.tag >>-test-answers-bonxie-pytest
243-
paths:
244-
- ~/test_results
154+
- build-and-test
245155

246156
docs-test:
247157
parameters:
@@ -260,13 +170,13 @@ jobs:
260170

261171
- restore_cache:
262172
name: "Restore dependencies cache."
263-
key: python-<< parameters.tag >>-dependencies-bonxie
173+
key: python-<< parameters.tag >>-dependencies-abbott
264174

265175
- install-with-yt-dev
266176

267177
- save_cache:
268178
name: "Save dependencies cache"
269-
key: python-<< parameters.tag >>-dependencies-bonxie
179+
key: python-<< parameters.tag >>-dependencies-abbott
270180
paths:
271181
- ~/.cache/pip
272182
- ~/venv
@@ -284,14 +194,10 @@ workflows:
284194
name: "Python 3.10 tests"
285195
tag: "3.10"
286196

287-
- run-tests-pytest:
197+
- run-tests:
288198
name: "Python 3.13 tests"
289199
tag: "3.13"
290200

291-
- run-tests-pytest:
292-
name: "Python 3.12 tests"
293-
tag: "3.12"
294-
295201
- docs-test:
296202
name: "Test docs build"
297203
tag: "3.13"
@@ -309,9 +215,9 @@ workflows:
309215
name: "Python 3.13 tests"
310216
tag: "3.13"
311217

312-
- run-tests-pytest:
313-
name: "Python 3.13 tests"
314-
tag: "3.13"
218+
- run-tests:
219+
name: "Python 3.10 tests"
220+
tag: "3.10"
315221

316222
- docs-test:
317223
name: "Test docs build"

.readthedocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# Required
77
version: 2
88

9+
sphinx:
10+
configuration: doc/source/conf.py
11+
912
# Set the version of Python and other tools you might need
1013
build:
1114
os: ubuntu-20.04

nose.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ select = [
101101
combine-as-imports = true
102102
known-third-party = [
103103
"IPython",
104-
"pynose",
105104
"numpy",
106105
"sympy",
107106
"matplotlib",

requirements/tests.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ astropy
33
scipy
44

55
# test dependencies
6-
pynose
7-
nose-timer
86
pytest
97
girder-client
10-
codecov
8+
9+
# tmp: girder-client 3.2.8 has an undeclared runtime dependency on setuptools
10+
# but it's already patched upstream
11+
# https://github.com/girder/girder/pull/3696
12+
setuptools<81

0 commit comments

Comments
 (0)