@@ -295,15 +295,15 @@ def test_python_pip_install_default():
295
295
assert build .python .install_with_pip is False
296
296
297
297
298
- def describe_validate_python_extra_requirements ( ):
298
+ class TestValidatePythonExtraRequirements ( object ):
299
299
300
- def it_defaults_to_list ( ):
300
+ def test_it_defaults_to_list ( self ):
301
301
build = get_build_config ({'python' : {}}, get_env_config ())
302
302
build .validate ()
303
303
# Default is an empty list.
304
304
assert build .python .extra_requirements == []
305
305
306
- def it_validates_is_a_list ( ):
306
+ def test_it_validates_is_a_list ( self ):
307
307
build = get_build_config (
308
308
{'python' : {'extra_requirements' : 'invalid' }},
309
309
get_env_config (),
@@ -314,7 +314,7 @@ def it_validates_is_a_list():
314
314
assert excinfo .value .code == PYTHON_INVALID
315
315
316
316
@patch ('readthedocs.config.config.validate_string' )
317
- def it_uses_validate_string ( validate_string ):
317
+ def test_it_uses_validate_string ( self , validate_string ):
318
318
validate_string .return_value = True
319
319
build = get_build_config (
320
320
{
@@ -329,14 +329,14 @@ def it_uses_validate_string(validate_string):
329
329
validate_string .assert_any_call ('tests' )
330
330
331
331
332
- def describe_validate_use_system_site_packages ( ):
332
+ class TestValidateUseSystemSitePackages ( object ):
333
333
334
- def it_defaults_to_false ( ):
334
+ def test_it_defaults_to_false ( self ):
335
335
build = get_build_config ({'python' : {}}, get_env_config ())
336
336
build .validate ()
337
337
assert build .python .use_system_site_packages is False
338
338
339
- def it_validates_value ( ):
339
+ def test_it_validates_value ( self ):
340
340
build = get_build_config (
341
341
{'python' : {'use_system_site_packages' : 'invalid' }},
342
342
get_env_config (),
@@ -347,7 +347,7 @@ def it_validates_value():
347
347
excinfo .value .code = INVALID_BOOL
348
348
349
349
@patch ('readthedocs.config.config.validate_bool' )
350
- def it_uses_validate_bool ( validate_bool ):
350
+ def test_it_uses_validate_bool ( self , validate_bool ):
351
351
validate_bool .return_value = True
352
352
build = get_build_config (
353
353
{'python' : {'use_system_site_packages' : 'to-validate' }},
@@ -357,14 +357,14 @@ def it_uses_validate_bool(validate_bool):
357
357
validate_bool .assert_any_call ('to-validate' )
358
358
359
359
360
- def describe_validate_setup_py_install ( ):
360
+ class TestValidateSetupPyInstall ( object ):
361
361
362
- def it_defaults_to_false ( ):
362
+ def test_it_defaults_to_false ( self ):
363
363
build = get_build_config ({'python' : {}}, get_env_config ())
364
364
build .validate ()
365
365
assert build .python .install_with_setup is False
366
366
367
- def it_validates_value ( ):
367
+ def test_it_validates_value ( self ):
368
368
build = get_build_config (
369
369
{'python' : {'setup_py_install' : 'this-is-string' }},
370
370
get_env_config (),
@@ -375,7 +375,7 @@ def it_validates_value():
375
375
assert excinfo .value .code == INVALID_BOOL
376
376
377
377
@patch ('readthedocs.config.config.validate_bool' )
378
- def it_uses_validate_bool ( validate_bool ):
378
+ def test_it_uses_validate_bool ( self , validate_bool ):
379
379
validate_bool .return_value = True
380
380
build = get_build_config (
381
381
{'python' : {'setup_py_install' : 'to-validate' }},
@@ -385,16 +385,16 @@ def it_uses_validate_bool(validate_bool):
385
385
validate_bool .assert_any_call ('to-validate' )
386
386
387
387
388
- def describe_validate_python_version ( ):
388
+ class TestValidatePythonVersion ( object ):
389
389
390
- def it_defaults_to_a_valid_version ( ):
390
+ def test_it_defaults_to_a_valid_version ( self ):
391
391
build = get_build_config ({'python' : {}}, get_env_config ())
392
392
build .validate ()
393
393
assert build .python .version == 2
394
394
assert build .python_interpreter == 'python2.7'
395
395
assert build .python_full_version == 2.7
396
396
397
- def it_supports_other_versions ( ):
397
+ def test_it_supports_other_versions ( self ):
398
398
build = get_build_config (
399
399
{'python' : {'version' : 3.5 }},
400
400
get_env_config (),
@@ -404,7 +404,7 @@ def it_supports_other_versions():
404
404
assert build .python_interpreter == 'python3.5'
405
405
assert build .python_full_version == 3.5
406
406
407
- def it_validates_versions_out_of_range ( ):
407
+ def test_it_validates_versions_out_of_range ( self ):
408
408
build = get_build_config (
409
409
{'python' : {'version' : 1.0 }},
410
410
get_env_config (),
@@ -414,7 +414,7 @@ def it_validates_versions_out_of_range():
414
414
assert excinfo .value .key == 'python.version'
415
415
assert excinfo .value .code == INVALID_CHOICE
416
416
417
- def it_validates_wrong_type ( ):
417
+ def test_it_validates_wrong_type ( self ):
418
418
build = get_build_config (
419
419
{'python' : {'version' : 'this-is-string' }},
420
420
get_env_config (),
@@ -424,7 +424,7 @@ def it_validates_wrong_type():
424
424
assert excinfo .value .key == 'python.version'
425
425
assert excinfo .value .code == INVALID_CHOICE
426
426
427
- def it_validates_wrong_type_right_value ( ):
427
+ def test_it_validates_wrong_type_right_value ( self ):
428
428
build = get_build_config (
429
429
{'python' : {'version' : '3.5' }},
430
430
get_env_config (),
@@ -443,7 +443,7 @@ def it_validates_wrong_type_right_value():
443
443
assert build .python_interpreter == 'python3.5'
444
444
assert build .python_full_version == 3.5
445
445
446
- def it_validates_env_supported_versions ( ):
446
+ def test_it_validates_env_supported_versions ( self ):
447
447
build = get_build_config (
448
448
{'python' : {'version' : 3.6 }},
449
449
env_config = get_env_config (
@@ -473,7 +473,7 @@ def it_validates_env_supported_versions():
473
473
assert build .python_full_version == 3.6
474
474
475
475
@pytest .mark .parametrize ('value' , [2 , 3 ])
476
- def it_respects_default_value ( value ):
476
+ def test_it_respects_default_value ( self , value ):
477
477
defaults = {
478
478
'python_version' : value ,
479
479
}
@@ -485,42 +485,42 @@ def it_respects_default_value(value):
485
485
assert build .python .version == value
486
486
487
487
488
- def describe_validate_formats ( ):
488
+ class TestValidateFormats ( object ):
489
489
490
- def it_defaults_to_empty ( ):
490
+ def test_it_defaults_to_empty ( self ):
491
491
build = get_build_config ({}, get_env_config ())
492
492
build .validate ()
493
493
assert build .formats == []
494
494
495
- def it_gets_set_correctly ( ):
495
+ def test_it_gets_set_correctly ( self ):
496
496
build = get_build_config ({'formats' : ['pdf' ]}, get_env_config ())
497
497
build .validate ()
498
498
assert build .formats == ['pdf' ]
499
499
500
- def formats_can_be_null ( ):
500
+ def test_formats_can_be_null ( self ):
501
501
build = get_build_config ({'formats' : None }, get_env_config ())
502
502
build .validate ()
503
503
assert build .formats == []
504
504
505
- def formats_with_previous_none ( ):
505
+ def test_formats_with_previous_none ( self ):
506
506
build = get_build_config ({'formats' : ['none' ]}, get_env_config ())
507
507
build .validate ()
508
508
assert build .formats == []
509
509
510
- def formats_can_be_empty ( ):
510
+ def test_formats_can_be_empty ( self ):
511
511
build = get_build_config ({'formats' : []}, get_env_config ())
512
512
build .validate ()
513
513
assert build .formats == []
514
514
515
- def all_valid_formats ( ):
515
+ def test_all_valid_formats ( self ):
516
516
build = get_build_config (
517
517
{'formats' : ['pdf' , 'htmlzip' , 'epub' ]},
518
518
get_env_config ()
519
519
)
520
520
build .validate ()
521
521
assert build .formats == ['pdf' , 'htmlzip' , 'epub' ]
522
522
523
- def cant_have_none_as_format ( ):
523
+ def test_cant_have_none_as_format ( self ):
524
524
build = get_build_config (
525
525
{'formats' : ['htmlzip' , None ]},
526
526
get_env_config ()
@@ -530,7 +530,7 @@ def cant_have_none_as_format():
530
530
assert excinfo .value .key == 'format'
531
531
assert excinfo .value .code == INVALID_CHOICE
532
532
533
- def formats_have_only_allowed_values ( ):
533
+ def test_formats_have_only_allowed_values ( self ):
534
534
build = get_build_config (
535
535
{'formats' : ['htmlzip' , 'csv' ]},
536
536
get_env_config ()
@@ -540,7 +540,7 @@ def formats_have_only_allowed_values():
540
540
assert excinfo .value .key == 'format'
541
541
assert excinfo .value .code == INVALID_CHOICE
542
542
543
- def only_list_type ( ):
543
+ def test_only_list_type ( self ):
544
544
build = get_build_config ({'formats' : 'no-list' }, get_env_config ())
545
545
with raises (InvalidConfig ) as excinfo :
546
546
build .validate ()
@@ -565,9 +565,9 @@ def test_valid_build_config():
565
565
assert build .output_base
566
566
567
567
568
- def describe_validate_base ( ):
568
+ class TestValidateBase ( object ):
569
569
570
- def it_validates_to_abspath ( tmpdir ):
570
+ def test_it_validates_to_abspath ( self , tmpdir ):
571
571
apply_fs (tmpdir , {'configs' : minimal_config , 'docs' : {}})
572
572
with tmpdir .as_cwd ():
573
573
source_file = str (tmpdir .join ('configs' , 'readthedocs.yml' ))
@@ -581,15 +581,15 @@ def it_validates_to_abspath(tmpdir):
581
581
assert build .base == str (tmpdir .join ('docs' ))
582
582
583
583
@patch ('readthedocs.config.config.validate_directory' )
584
- def it_uses_validate_directory ( validate_directory ):
584
+ def test_it_uses_validate_directory ( self , validate_directory ):
585
585
validate_directory .return_value = 'path'
586
586
build = get_build_config ({'base' : '../my-path' }, get_env_config ())
587
587
build .validate ()
588
588
# Test for first argument to validate_directory
589
589
args , kwargs = validate_directory .call_args
590
590
assert args [0 ] == '../my-path'
591
591
592
- def it_fails_if_base_is_not_a_string ( tmpdir ):
592
+ def test_it_fails_if_base_is_not_a_string ( self , tmpdir ):
593
593
apply_fs (tmpdir , minimal_config )
594
594
with tmpdir .as_cwd ():
595
595
build = BuildConfigV1 (
@@ -603,7 +603,7 @@ def it_fails_if_base_is_not_a_string(tmpdir):
603
603
assert excinfo .value .key == 'base'
604
604
assert excinfo .value .code == INVALID_STRING
605
605
606
- def it_fails_if_base_does_not_exist ( tmpdir ):
606
+ def test_it_fails_if_base_does_not_exist ( self , tmpdir ):
607
607
apply_fs (tmpdir , minimal_config )
608
608
build = BuildConfigV1 (
609
609
get_env_config (),
@@ -617,9 +617,9 @@ def it_fails_if_base_does_not_exist(tmpdir):
617
617
assert excinfo .value .code == INVALID_PATH
618
618
619
619
620
- def describe_validate_build ( ):
620
+ class TestValidateBuild ( object ):
621
621
622
- def it_fails_if_build_is_invalid_option ( tmpdir ):
622
+ def test_it_fails_if_build_is_invalid_option ( self , tmpdir ):
623
623
apply_fs (tmpdir , minimal_config )
624
624
build = BuildConfigV1 (
625
625
get_env_config (),
@@ -632,7 +632,7 @@ def it_fails_if_build_is_invalid_option(tmpdir):
632
632
assert excinfo .value .key == 'build'
633
633
assert excinfo .value .code == INVALID_CHOICE
634
634
635
- def it_fails_on_python_validation ( tmpdir ):
635
+ def test_it_fails_on_python_validation ( self , tmpdir ):
636
636
apply_fs (tmpdir , minimal_config )
637
637
build = BuildConfigV1 (
638
638
{},
@@ -649,7 +649,7 @@ def it_fails_on_python_validation(tmpdir):
649
649
assert excinfo .value .key == 'python.version'
650
650
assert excinfo .value .code == INVALID_CHOICE
651
651
652
- def it_works_on_python_validation ( tmpdir ):
652
+ def test_it_works_on_python_validation ( self , tmpdir ):
653
653
apply_fs (tmpdir , minimal_config )
654
654
build = BuildConfigV1 (
655
655
{},
@@ -663,7 +663,7 @@ def it_works_on_python_validation(tmpdir):
663
663
build .validate_build ()
664
664
build .validate_python ()
665
665
666
- def it_works ( tmpdir ):
666
+ def test_it_works ( self , tmpdir ):
667
667
apply_fs (tmpdir , minimal_config )
668
668
build = BuildConfigV1 (
669
669
get_env_config (),
@@ -674,7 +674,7 @@ def it_works(tmpdir):
674
674
build .validate ()
675
675
assert build .build .image == 'readthedocs/build:latest'
676
676
677
- def default ( tmpdir ):
677
+ def test_default ( self , tmpdir ):
678
678
apply_fs (tmpdir , minimal_config )
679
679
build = BuildConfigV1 (
680
680
get_env_config (),
@@ -687,7 +687,7 @@ def default(tmpdir):
687
687
688
688
@pytest .mark .parametrize (
689
689
'image' , ['latest' , 'readthedocs/build:3.0' , 'rtd/build:latest' ])
690
- def it_priorities_image_from_env_config ( tmpdir , image ):
690
+ def test_it_priorities_image_from_env_config ( self , tmpdir , image ):
691
691
apply_fs (tmpdir , minimal_config )
692
692
defaults = {
693
693
'build_image' : image ,
0 commit comments