@@ -360,10 +360,17 @@ def needs_rsync3(test_item: MT) -> MT:
360
360
return test_item
361
361
362
362
363
+ def needs_online (test_item : MT ) -> MT :
364
+ """Use as a decorator before test classes or methods to run only if we are meant to talk to the Internet."""
365
+ test_item = _mark_test ('online' , test_item )
366
+ if os .getenv ('TOIL_SKIP_ONLINE' , '' ).lower () == 'true' :
367
+ return unittest .skip ('Skipping online test.' )(test_item )
368
+ return test_item
369
+
363
370
def needs_aws_s3 (test_item : MT ) -> MT :
364
371
"""Use as a decorator before test classes or methods to run only if AWS S3 is usable."""
365
372
# TODO: we just check for generic access to the AWS account
366
- test_item = _mark_test ('aws-s3' , test_item )
373
+ test_item = _mark_test ('aws-s3' , needs_online ( test_item ) )
367
374
try :
368
375
from boto import config
369
376
boto_credentials = config .get ('Credentials' , 'aws_access_key_id' )
@@ -416,7 +423,7 @@ def needs_google_storage(test_item: MT) -> MT:
416
423
Cloud is installed and we ought to be able to access public Google Storage
417
424
URIs.
418
425
"""
419
- test_item = _mark_test ('google-storage' , test_item )
426
+ test_item = _mark_test ('google-storage' , needs_online ( test_item ) )
420
427
try :
421
428
from google .cloud import storage # noqa
422
429
except ImportError :
@@ -428,7 +435,7 @@ def needs_google_project(test_item: MT) -> MT:
428
435
"""
429
436
Use as a decorator before test classes or methods to run only if we have a Google Cloud project set.
430
437
"""
431
- test_item = _mark_test ('google-project' , test_item )
438
+ test_item = _mark_test ('google-project' , needs_online ( test_item ) )
432
439
test_item = needs_env_var ('TOIL_GOOGLE_PROJECTID' , "a Google project ID" )(test_item )
433
440
return test_item
434
441
@@ -460,7 +467,7 @@ def needs_kubernetes_installed(test_item: MT) -> MT:
460
467
461
468
def needs_kubernetes (test_item : MT ) -> MT :
462
469
"""Use as a decorator before test classes or methods to run only if Kubernetes is installed and configured."""
463
- test_item = needs_kubernetes_installed (test_item )
470
+ test_item = needs_kubernetes_installed (needs_online ( test_item ) )
464
471
try :
465
472
import kubernetes
466
473
try :
@@ -539,7 +546,7 @@ def needs_docker(test_item: MT) -> MT:
539
546
Use as a decorator before test classes or methods to only run them if
540
547
docker is installed and docker-based tests are enabled.
541
548
"""
542
- test_item = _mark_test ('docker' , test_item )
549
+ test_item = _mark_test ('docker' , needs_online ( test_item ) )
543
550
if os .getenv ('TOIL_SKIP_DOCKER' , '' ).lower () == 'true' :
544
551
return unittest .skip ('Skipping docker test.' )(test_item )
545
552
if which ('docker' ):
@@ -552,7 +559,7 @@ def needs_singularity(test_item: MT) -> MT:
552
559
Use as a decorator before test classes or methods to only run them if
553
560
singularity is installed.
554
561
"""
555
- test_item = _mark_test ('singularity' , test_item )
562
+ test_item = _mark_test ('singularity' , needs_online ( test_item ) )
556
563
if which ('singularity' ):
557
564
return test_item
558
565
else :
@@ -589,7 +596,7 @@ def needs_docker_cuda(test_item: MT) -> MT:
589
596
Use as a decorator before test classes or methods to only run them if
590
597
a CUDA setup is available through Docker.
591
598
"""
592
- test_item = _mark_test ('docker_cuda' , test_item )
599
+ test_item = _mark_test ('docker_cuda' , needs_online ( test_item ) )
593
600
if have_working_nvidia_docker_runtime ():
594
601
return test_item
595
602
else :
@@ -645,7 +652,7 @@ def needs_celery_broker(test_item: MT) -> MT:
645
652
"""
646
653
Use as a decorator before test classes or methods to run only if RabbitMQ is set up to take Celery jobs.
647
654
"""
648
- test_item = _mark_test ('celery' , test_item )
655
+ test_item = _mark_test ('celery' , needs_online ( test_item ) )
649
656
test_item = needs_env_var ('TOIL_WES_BROKER_URL' , "a URL to a RabbitMQ broker for Celery" )(test_item )
650
657
return test_item
651
658
@@ -654,7 +661,7 @@ def needs_wes_server(test_item: MT) -> MT:
654
661
Use as a decorator before test classes or methods to run only if a WES
655
662
server is available to run against.
656
663
"""
657
- test_item = _mark_test ('wes_server' , test_item )
664
+ test_item = _mark_test ('wes_server' , needs_online ( test_item ) )
658
665
659
666
wes_url = os .environ .get ('TOIL_WES_ENDPOINT' )
660
667
if not wes_url :
@@ -712,7 +719,7 @@ def needs_fetchable_appliance(test_item: MT) -> MT:
712
719
the Toil appliance Docker image is able to be downloaded from the Internet.
713
720
"""
714
721
715
- test_item = _mark_test ('fetchable_appliance' , test_item )
722
+ test_item = _mark_test ('fetchable_appliance' , needs_online ( test_item ) )
716
723
if os .getenv ('TOIL_SKIP_DOCKER' , '' ).lower () == 'true' :
717
724
return unittest .skip ('Skipping docker test.' )(test_item )
718
725
try :
@@ -733,9 +740,7 @@ def integrative(test_item: MT) -> MT:
733
740
Use this to decorate integration tests so as to skip them during regular builds.
734
741
735
742
We define integration tests as A) involving other, non-Toil software components
736
- that we develop and/or B) having a higher cost (time or money). Note that brittleness
737
- does not qualify a test for being integrative. Neither does involvement of external
738
- services such as AWS, since that would cover most of Toil's test.
743
+ that we develop and/or B) having a higher cost (time or money).
739
744
"""
740
745
test_item = _mark_test ('integrative' , test_item )
741
746
if os .getenv ('TOIL_TEST_INTEGRATIVE' , '' ).lower () == 'true' :
0 commit comments