Commits

Akeem Wells authored 8d2d48b9c24
Update Readme to include how to use sparse_check

casatestutils/README.md

Modified
1 1 # casatestutils Package
2 2
3 +**Table of Contents**
4 +
5 +- [casatestutils](#intro) : Generic testhelper module
6 +- [runtest.py](#runtest): Wrapper to run tests using pytest
7 +- [sparse_check.py](#sparse_check): Tool to do sparse checkout of data from casatestdata.git
8 +
3 9 ## casatestutils
4 10 A generic testhelper module for use with CASA testing.
5 11
6 -Documentation: https://open-confluence.nrao.edu/display/CASA/casatestutils%3A+A+generic+test+helper+module
12 +Internal documentation: https://open-confluence.nrao.edu/display/CASA/casatestutils%3A+A+generic+test+helper+module
7 13
8 14 ## runtest.py
9 15 [runtest.py](casatestutils/runtest.py) is a single test wrapper to run CASA Python tests. The script can run one or
10 16 more scripts and will create a directory called ```nosedir``` in the working directory and inside nosedir it will create
11 17 a separated directory with the test name to hold any files created by each test script.
12 18
13 19 With the latest version, runtest.py will also create a file called ```short_summary.log``` inside each
14 20 test directory with a single line summary of the exit status of each test of the script. If more than one test
15 21 script is run at the same time, runtest.py will create a file called ```summary_of_failed.log``` inside the top
16 22 directory nosedir. This file will give the error messages of a ny test cases that failed or was skipped. In case all
167 173
168 174 Run locally using a casa tarball:
169 175 ```
170 176 <tarball>/bin/pip3 install jupyter
171 177
172 178 <tarball>/bin/python3 -m jupyter notebook --generate-config
173 179
174 180 <tarball>/bin/python3 -m jupyter notebook --browser=firefox --ip='*' --NotebookApp.toke='' --NotebookApp.password='' tests/nb_test_runtest.ipynb
175 181 ```
176 182 Run in [Google Colab](https://colab.research.google.com/drive/1lunhY-8iLot2H0UwFJ98_IWsmBM2TIMd?usp=sharing)
183 +
184 +## sparse_check.py
185 +Download test datasets from casatestdata.git using a sparse checkout. Use it inside a script or
186 +in the command line. See the usage:
187 +```
188 +./python3 sparse_check.py -h
189 +```
190 +
191 +#### from a script
192 +Import the module to download datasets on-the-fly based on the dataset name stored in casatestdata.git.
193 +```
194 +from casatestutils import sparse_check
195 +sparse_check.download_data(["ngc5921.ms"])
196 +```
197 +#### from the command line
198 +Download datasets used in a specific test script based on the taskname. The script will create a
199 +taskname-data file with the contents to be fetched from git and will create a casatestdata directory
200 +locally containing the symbolic links to the datasets. Follow the below steps to
201 +do the sparse checkout for task_flagdata.
202 +```
203 +./python3 sparse_check.py -j flagdata
204 +cd casatestdata
205 +mv ../flagdata-data .
206 +source flagdata-data
207 +git checkout master
208 +cd ../
209 +```
210 +With the above steps the datasets needed to run the flagdata tests will be checked out to casatestdata.
211 +Run the tests in the usual way; for example:
212 +```
213 +./python3 ./test_task_flagdata.py
214 +```

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut