Skip to content

Commit dc84620

Browse files
author
Beat Buesser
committed
Update run_tests.sh
Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
1 parent 0c2ee90 commit dc84620

File tree

7 files changed

+24
-41
lines changed

7 files changed

+24
-41
lines changed

.github/actions/deepspeech-v2/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
exit_code=0
44

5-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/speech_recognition/test_pytorch_deep_speech.py --framework=pytorch --skip_travis=True --durations=0
5+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/speech_recognition/test_pytorch_deep_speech.py --framework=pytorch --durations=0
66
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed estimators/speech_recognition/test_pytorch_deep_speech tests"; fi
7-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/attacks/evasion/test_imperceptible_asr_pytorch.py --framework=pytorch --skip_travis=True --durations=0
7+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/attacks/evasion/test_imperceptible_asr_pytorch.py --framework=pytorch --durations=0
88
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed attacks/evasion/test_imperceptible_asr_pytorch tests"; fi
99

1010
exit ${exit_code}

.github/actions/deepspeech-v3/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
exit_code=0
44

5-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/speech_recognition/test_pytorch_deep_speech.py --framework=pytorch --skip_travis=True --durations=0
5+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/speech_recognition/test_pytorch_deep_speech.py --framework=pytorch --durations=0
66
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed estimators/speech_recognition/test_pytorch_deep_speech tests"; fi
7-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/attacks/evasion/test_imperceptible_asr_pytorch.py --framework=pytorch --skip_travis=True --durations=0
7+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/attacks/evasion/test_imperceptible_asr_pytorch.py --framework=pytorch --durations=0
88
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed attacks/evasion/test_imperceptible_asr_pytorch tests"; fi
99

1010
exit ${exit_code}

.github/workflows/ci-pytorch-fasterrcnn.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ jobs:
4444
pip install torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
4545
pip install torchaudio==0.6.0 -f https://download.pytorch.org/whl/torch_stable.html
4646
- name: Run Test Action
47-
run: pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/object_detection/test_pytorch_faster_rcnn.py --framework=pytorch --skip_travis=True --durations=0
47+
run: pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/object_detection/test_pytorch_faster_rcnn.py --framework=pytorch --durations=0
4848
- name: Upload coverage to Codecov
4949
uses: codecov/codecov-action@v2.0.2

art/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ def to_cuda(x: "torch.Tensor") -> "torch.Tensor":
13331333

13341334
use_cuda = is_available()
13351335
if use_cuda:
1336-
x = x.cuda()
1336+
x = x.cuda() # pragma: no_cover
13371337
return x
13381338

13391339

@@ -1348,5 +1348,5 @@ def from_cuda(x: "torch.Tensor") -> "torch.Tensor":
13481348

13491349
use_cuda = is_available()
13501350
if use_cuda:
1351-
x = x.cpu()
1351+
x = x.cpu() # pragma: no_cover
13521352
return x

conftest.py

-17
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ def pytest_addoption(parser):
8181
help="ART tests allow you to specify which framework to use. The default framework used is `tensorflow`. "
8282
"Other options available are {0}".format(art_supported_frameworks),
8383
)
84-
parser.addoption(
85-
"--skip_travis",
86-
action="store",
87-
default=False,
88-
help="Whether tests annotated with the decorator skip_travis should be skipped or not",
89-
)
9084

9185

9286
@pytest.fixture
@@ -803,17 +797,6 @@ def skip_by_framework(request, framework):
803797
pytest.skip("skipped on this platform: {}".format(framework))
804798

805799

806-
@pytest.fixture(autouse=True)
807-
def skip_travis(request):
808-
"""
809-
Skips a test marked with this decorator if the command line argument skip_travis is set to true
810-
:param request:
811-
:return:
812-
"""
813-
if request.node.get_closest_marker("skip_travis") and request.config.getoption("--skip_travis"):
814-
pytest.skip("skipped due to skip_travis being set to {}".format(skip_travis))
815-
816-
817800
@pytest.fixture
818801
def make_customer_record():
819802
def _make_customer_record(name):

run_tests.sh

+17-16
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,52 @@ then
1717
echo "############### Running tests with framework $framework ###############"
1818
echo "#######################################################################"
1919

20-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/detector/poison/test_spectral_signature_defense.py --framework=$framework --skip_travis=True --durations=0
20+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/detector/poison/test_spectral_signature_defense.py --framework=$framework --durations=0
2121
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed defences/detector/poison/test_spectral_signature_defense.py tests"; fi
2222

23-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/preprocessor --framework=$framework --skip_travis=True --durations=0
23+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/preprocessor --framework=$framework --durations=0
2424
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed defences/preprocessor tests"; fi
2525

26-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/transformer --framework=$framework --skip_travis=True --durations=0
26+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/transformer --framework=$framework --durations=0
2727
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed defences/transformer tests"; fi
2828

29-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/preprocessing/audio --framework=$framework --skip_travis=True --durations=0
29+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/preprocessing/audio --framework=$framework --durations=0
3030
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed preprocessing/audio tests"; fi
3131

32-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/preprocessing/expectation_over_transformation --framework=$framework --skip_travis=True --durations=0
32+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/preprocessing/expectation_over_transformation --framework=$framework --durations=0
3333
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed preprocessing/expectation_over_transformation tests"; fi
3434

35-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/utils --framework=$framework --skip_travis=True --durations=0
35+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/utils --framework=$framework --durations=0
3636
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed utils tests"; fi
3737

38-
pytest --cov-report=xml --cov=art --cov-append -q -vv -s tests/attacks/poison/ --framework=$framework --skip_travis=True --durations=0
38+
pytest --cov-report=xml --cov=art --cov-append -q -vv -s tests/attacks/poison/ --framework=$framework --durations=0
3939
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed attacks/poison tests"; fi
4040

41-
pytest --cov-report=xml --cov=art --cov-append -q -vv -s tests/attacks/evasion/ --framework=$framework --skip_travis=True --durations=0
41+
pytest --cov-report=xml --cov=art --cov-append -q -vv -s tests/attacks/evasion/ --framework=$framework --durations=0
4242
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed attacks/evasion/test_shadow_attack.py"; fi
4343

44-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/speech_recognition/ --framework=$framework --skip_travis=True --durations=0
44+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/speech_recognition/ --framework=$framework --durations=0
4545
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed estimators/speech_recognition tests"; fi
4646

47-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/attacks/inference/ --framework=$framework --skip_travis=True --durations=0
47+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/attacks/inference/ --framework=$framework --durations=0
4848
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed attacks/inference"; fi
4949

5050
pytest -q -s tests/attacks/evasion/test_brendel_and_bethge.py --framework=$framework --durations=0
5151
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed attacks/evasion/test_brendel_and_bethge.py"; fi
5252

53-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/classifiersFrameworks/ --framework=$framework --skip_travis=True --durations=0
53+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/classifiersFrameworks/ --framework=$framework --durations=0
5454
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed classifiersFrameworks tests"; fi
5555

56-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/preprocessor/test_spatial_smoothing_pytorch.py --framework=$framework --skip_travis=True --durations=0
56+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/defences/preprocessor/test_spatial_smoothing_pytorch.py --framework=$framework --durations=0
5757
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed defences/preprocessor/test_spatial_smoothing_pytorch.py tests"; fi
5858

59-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/classification/test_deeplearning_common.py --framework=$framework --skip_travis=True --durations=0
59+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/classification/test_deeplearning_common.py --framework=$framework --durations=0
6060
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed estimators/classification/test_deeplearning_common.py $framework"; fi
6161

62-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/classification/test_deeplearning_specific.py --framework=$framework --skip_travis=True --durations=0
62+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/classification/test_deeplearning_specific.py --framework=$framework --durations=0
6363
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed estimators/classification tests for framework $framework"; fi
6464

65-
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/metrics/privacy --framework=$framework --skip_travis=True --durations=0
65+
pytest --cov-report=xml --cov=art --cov-append -q -vv tests/metrics/privacy --framework=$framework --durations=0
6666
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed metrics/privacy tests"; fi
6767
else
6868
declare -a attacks=("tests/attacks/test_adversarial_patch.py" \
@@ -166,7 +166,8 @@ else
166166
echo "######################################################################"
167167
echo ${test}
168168
echo "######################################################################"
169-
coverage run --append -m unittest -v ${test}
169+
# coverage run --append -m unittest -v ${test}
170+
pytest --cov-report=xml --cov=art --cov-append -q -vv ${test} --durations=0
170171
if [[ $? -ne 0 ]]; then exit_code=1; echo "Failed $test"; fi
171172
}
172173

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ markers =
1212
skip_framework: marks a test to be skipped for specific framework values. Valid values are ("tensorflow" "keras" "mxnet" "pytorch" "scikitlearn")
1313
only_with_platform: DEPRECATED only used for legacy tests. Use skip_framework instead. marks a test to be performed only for a specific framework value
1414
framework_agnostic: marks a test to be agnostic to frameworks and run only for one default framework
15-
skip_travis: Skips a test marked with this decorator if the command line argument skip_travis is set to true
1615
skip_module: Skip the test if a module is not available in the current environment
1716

1817
[mypy]

0 commit comments

Comments
 (0)