unittest.ps1 1.05 KB
Newer Older
1
$CWD = $PWD
chicm-ms's avatar
chicm-ms committed
2
$ErrorActionPreference = "Stop"
3
4
5
6
7
8
# -------------For python unittest-------------

## ------Run annotation test------
echo ""
echo "===========================Testing: nni_annotation==========================="
cd $CWD/../tools/
9
10
11
12
cmd /c "python -m unittest -v nni_annotation/test_annotation.py 2>&1"
if ($LASTEXITCODE -ne 0) {
    throw "Exit code $LASTEXITCODE"
}
13
14
15
16
17
18
19
20
21

## Export certain environment variables for unittest code to work
$env:NNI_TRIAL_JOB_ID="test_trial_job_id"
$env:NNI_PLATFORM="unittest"

## ------Run sdk test------
echo ""
echo "===========================Testing: nni_sdk==========================="
cd $CWD/../src/sdk/pynni/
22
23
24
25
cmd /c "python -m unittest discover -v tests 2>&1"
if ($LASTEXITCODE -ne 0) {
    throw "Exit code $LASTEXITCODE"
}
26
27
28
29
30

# -------------For typescript unittest-------------
cd $CWD/../src/nni_manager
echo ""
echo "===========================Testing: nni_manager==========================="
31
32
33
34
35
cmd /c "npm run test 2>&1"
# don't check now. adding back later.
# if ($LASTEXITCODE -ne 0) {
#     throw "Exit code $LASTEXITCODE"
# }