@@ -274,15 +274,15 @@ def test_python_pip_install_default():
274
274
assert build .python .install_with_pip is False
275
275
276
276
277
- class ValidatePythonExtraRequirements :
277
+ class TestValidatePythonExtraRequirements ( object ) :
278
278
279
- def it_defaults_to_list (self ):
279
+ def test_it_defaults_to_list (self ):
280
280
build = get_build_config ({'python' : {}}, get_env_config ())
281
281
build .validate ()
282
282
# Default is an empty list.
283
283
assert build .python .extra_requirements == []
284
284
285
- def it_validates_is_a_list (self ):
285
+ def test_it_validates_is_a_list (self ):
286
286
build = get_build_config (
287
287
{'python' : {'extra_requirements' : 'invalid' }},
288
288
get_env_config (),
@@ -293,7 +293,7 @@ def it_validates_is_a_list(self):
293
293
assert excinfo .value .code == PYTHON_INVALID
294
294
295
295
@patch ('readthedocs.config.config.validate_string' )
296
- def it_uses_validate_string (self , validate_string ):
296
+ def test_it_uses_validate_string (self , validate_string ):
297
297
validate_string .return_value = True
298
298
build = get_build_config (
299
299
{
@@ -308,14 +308,14 @@ def it_uses_validate_string(self, validate_string):
308
308
validate_string .assert_any_call ('tests' )
309
309
310
310
311
- class ValidateUseSystemSitePackages :
311
+ class TestValidateUseSystemSitePackages ( object ) :
312
312
313
- def it_defaults_to_false (self ):
313
+ def test_it_defaults_to_false (self ):
314
314
build = get_build_config ({'python' : {}}, get_env_config ())
315
315
build .validate ()
316
316
assert build .python .use_system_site_packages is False
317
317
318
- def it_validates_value (self ):
318
+ def test_it_validates_value (self ):
319
319
build = get_build_config (
320
320
{'python' : {'use_system_site_packages' : 'invalid' }},
321
321
get_env_config (),
@@ -326,7 +326,7 @@ def it_validates_value(self):
326
326
excinfo .value .code = INVALID_BOOL
327
327
328
328
@patch ('readthedocs.config.config.validate_bool' )
329
- def it_uses_validate_bool (self , validate_bool ):
329
+ def test_it_uses_validate_bool (self , validate_bool ):
330
330
validate_bool .return_value = True
331
331
build = get_build_config (
332
332
{'python' : {'use_system_site_packages' : 'to-validate' }},
@@ -336,14 +336,14 @@ def it_uses_validate_bool(self, validate_bool):
336
336
validate_bool .assert_any_call ('to-validate' )
337
337
338
338
339
- class ValidateSetupPyInstall :
339
+ class TestValidateSetupPyInstall ( object ) :
340
340
341
- def it_defaults_to_false (self ):
341
+ def test_it_defaults_to_false (self ):
342
342
build = get_build_config ({'python' : {}}, get_env_config ())
343
343
build .validate ()
344
344
assert build .python .install_with_setup is False
345
345
346
- def it_validates_value (self ):
346
+ def test_it_validates_value (self ):
347
347
build = get_build_config (
348
348
{'python' : {'setup_py_install' : 'this-is-string' }},
349
349
get_env_config (),
@@ -354,7 +354,7 @@ def it_validates_value(self):
354
354
assert excinfo .value .code == INVALID_BOOL
355
355
356
356
@patch ('readthedocs.config.config.validate_bool' )
357
- def it_uses_validate_bool (self , validate_bool ):
357
+ def test_it_uses_validate_bool (self , validate_bool ):
358
358
validate_bool .return_value = True
359
359
build = get_build_config (
360
360
{'python' : {'setup_py_install' : 'to-validate' }},
@@ -364,16 +364,16 @@ def it_uses_validate_bool(self, validate_bool):
364
364
validate_bool .assert_any_call ('to-validate' )
365
365
366
366
367
- class ValidateVersion :
367
+ class TestValidatePythonVersion ( object ) :
368
368
369
- def it_defaults_to_a_valid_version (self ):
369
+ def test_it_defaults_to_a_valid_version (self ):
370
370
build = get_build_config ({'python' : {}}, get_env_config ())
371
371
build .validate ()
372
372
assert build .python .version == 2
373
373
assert build .python_interpreter == 'python2.7'
374
374
assert build .python_full_version == 2.7
375
375
376
- def it_supports_other_versions (self ):
376
+ def test_it_supports_other_versions (self ):
377
377
build = get_build_config (
378
378
{'python' : {'version' : 3.5 }},
379
379
get_env_config (),
@@ -383,7 +383,7 @@ def it_supports_other_versions(self):
383
383
assert build .python_interpreter == 'python3.5'
384
384
assert build .python_full_version == 3.5
385
385
386
- def it_validates_versions_out_of_range (self ):
386
+ def test_it_validates_versions_out_of_range (self ):
387
387
build = get_build_config (
388
388
{'python' : {'version' : 1.0 }},
389
389
get_env_config (),
@@ -393,7 +393,7 @@ def it_validates_versions_out_of_range(self):
393
393
assert excinfo .value .key == 'python.version'
394
394
assert excinfo .value .code == INVALID_CHOICE
395
395
396
- def it_validates_wrong_type (self ):
396
+ def test_it_validates_wrong_type (self ):
397
397
build = get_build_config (
398
398
{'python' : {'version' : 'this-is-string' }},
399
399
get_env_config (),
@@ -403,7 +403,7 @@ def it_validates_wrong_type(self):
403
403
assert excinfo .value .key == 'python.version'
404
404
assert excinfo .value .code == INVALID_CHOICE
405
405
406
- def it_validates_wrong_type_right_value (self ):
406
+ def test_it_validates_wrong_type_right_value (self ):
407
407
build = get_build_config (
408
408
{'python' : {'version' : '3.5' }},
409
409
get_env_config (),
@@ -422,7 +422,7 @@ def it_validates_wrong_type_right_value(self):
422
422
assert build .python_interpreter == 'python3.5'
423
423
assert build .python_full_version == 3.5
424
424
425
- def it_validates_env_supported_versions (self ):
425
+ def test_it_validates_env_supported_versions (self ):
426
426
build = get_build_config (
427
427
{'python' : {'version' : 3.6 }},
428
428
env_config = get_env_config (
@@ -452,7 +452,7 @@ def it_validates_env_supported_versions(self):
452
452
assert build .python_full_version == 3.6
453
453
454
454
@pytest .mark .parametrize ('value' , [2 , 3 ])
455
- def it_respects_default_value (self , value ):
455
+ def test_it_respects_default_value (self , value ):
456
456
defaults = {
457
457
'python_version' : value ,
458
458
}
@@ -464,42 +464,42 @@ def it_respects_default_value(self, value):
464
464
assert build .python .version == value
465
465
466
466
467
- class ValidateFormats :
467
+ class TestValidateFormats ( object ) :
468
468
469
- def it_defaults_to_empty (self ):
469
+ def test_it_defaults_to_empty (self ):
470
470
build = get_build_config ({}, get_env_config ())
471
471
build .validate ()
472
472
assert build .formats == []
473
473
474
- def it_gets_set_correctly (self ):
474
+ def test_it_gets_set_correctly (self ):
475
475
build = get_build_config ({'formats' : ['pdf' ]}, get_env_config ())
476
476
build .validate ()
477
477
assert build .formats == ['pdf' ]
478
478
479
- def formats_can_be_null (self ):
479
+ def test_formats_can_be_null (self ):
480
480
build = get_build_config ({'formats' : None }, get_env_config ())
481
481
build .validate ()
482
482
assert build .formats == []
483
483
484
- def formats_with_previous_none (self ):
484
+ def test_formats_with_previous_none (self ):
485
485
build = get_build_config ({'formats' : ['none' ]}, get_env_config ())
486
486
build .validate ()
487
487
assert build .formats == []
488
488
489
- def formats_can_be_empty (self ):
489
+ def test_formats_can_be_empty (self ):
490
490
build = get_build_config ({'formats' : []}, get_env_config ())
491
491
build .validate ()
492
492
assert build .formats == []
493
493
494
- def all_valid_formats (self ):
494
+ def test_all_valid_formats (self ):
495
495
build = get_build_config (
496
496
{'formats' : ['pdf' , 'htmlzip' , 'epub' ]},
497
497
get_env_config ()
498
498
)
499
499
build .validate ()
500
500
assert build .formats == ['pdf' , 'htmlzip' , 'epub' ]
501
501
502
- def cant_have_none_as_format (self ):
502
+ def test_cant_have_none_as_format (self ):
503
503
build = get_build_config (
504
504
{'formats' : ['htmlzip' , None ]},
505
505
get_env_config ()
@@ -509,7 +509,7 @@ def cant_have_none_as_format(self):
509
509
assert excinfo .value .key == 'format'
510
510
assert excinfo .value .code == INVALID_CHOICE
511
511
512
- def formats_have_only_allowed_values (self ):
512
+ def test_formats_have_only_allowed_values (self ):
513
513
build = get_build_config (
514
514
{'formats' : ['htmlzip' , 'csv' ]},
515
515
get_env_config ()
@@ -519,7 +519,7 @@ def formats_have_only_allowed_values(self):
519
519
assert excinfo .value .key == 'format'
520
520
assert excinfo .value .code == INVALID_CHOICE
521
521
522
- def only_list_type (self ):
522
+ def test_only_list_type (self ):
523
523
build = get_build_config ({'formats' : 'no-list' }, get_env_config ())
524
524
with raises (InvalidConfig ) as excinfo :
525
525
build .validate ()
@@ -544,9 +544,9 @@ def test_valid_build_config():
544
544
assert build .output_base
545
545
546
546
547
- class ValidateBase :
547
+ class TestValidateBase ( object ) :
548
548
549
- def it_validates_to_abspath (self , tmpdir ):
549
+ def test_it_validates_to_abspath (self , tmpdir ):
550
550
apply_fs (tmpdir , {'configs' : minimal_config , 'docs' : {}})
551
551
with tmpdir .as_cwd ():
552
552
source_file = str (tmpdir .join ('configs' , 'readthedocs.yml' ))
@@ -560,15 +560,15 @@ def it_validates_to_abspath(self, tmpdir):
560
560
assert build .base == str (tmpdir .join ('docs' ))
561
561
562
562
@patch ('readthedocs.config.config.validate_directory' )
563
- def it_uses_validate_directory (self , validate_directory ):
563
+ def test_it_uses_validate_directory (self , validate_directory ):
564
564
validate_directory .return_value = 'path'
565
565
build = get_build_config ({'base' : '../my-path' }, get_env_config ())
566
566
build .validate ()
567
567
# Test for first argument to validate_directory
568
568
args , kwargs = validate_directory .call_args
569
569
assert args [0 ] == '../my-path'
570
570
571
- def it_fails_if_base_is_not_a_string (self , tmpdir ):
571
+ def test_it_fails_if_base_is_not_a_string (self , tmpdir ):
572
572
apply_fs (tmpdir , minimal_config )
573
573
with tmpdir .as_cwd ():
574
574
build = BuildConfigV1 (
@@ -582,7 +582,7 @@ def it_fails_if_base_is_not_a_string(self, tmpdir):
582
582
assert excinfo .value .key == 'base'
583
583
assert excinfo .value .code == INVALID_STRING
584
584
585
- def it_fails_if_base_does_not_exist (self , tmpdir ):
585
+ def test_it_fails_if_base_does_not_exist (self , tmpdir ):
586
586
apply_fs (tmpdir , minimal_config )
587
587
build = BuildConfigV1 (
588
588
get_env_config (),
@@ -596,9 +596,9 @@ def it_fails_if_base_does_not_exist(self, tmpdir):
596
596
assert excinfo .value .code == INVALID_PATH
597
597
598
598
599
- class ValidateBuild :
599
+ class TestValidateBuild ( object ) :
600
600
601
- def it_fails_if_build_is_invalid_option (self , tmpdir ):
601
+ def test_it_fails_if_build_is_invalid_option (self , tmpdir ):
602
602
apply_fs (tmpdir , minimal_config )
603
603
build = BuildConfigV1 (
604
604
get_env_config (),
@@ -611,7 +611,7 @@ def it_fails_if_build_is_invalid_option(self, tmpdir):
611
611
assert excinfo .value .key == 'build'
612
612
assert excinfo .value .code == INVALID_CHOICE
613
613
614
- def it_fails_on_python_validation (self , tmpdir ):
614
+ def test_it_fails_on_python_validation (self , tmpdir ):
615
615
apply_fs (tmpdir , minimal_config )
616
616
build = BuildConfigV1 (
617
617
{},
@@ -628,7 +628,7 @@ def it_fails_on_python_validation(self, tmpdir):
628
628
assert excinfo .value .key == 'python.version'
629
629
assert excinfo .value .code == INVALID_CHOICE
630
630
631
- def it_works_on_python_validation (self , tmpdir ):
631
+ def test_it_works_on_python_validation (self , tmpdir ):
632
632
apply_fs (tmpdir , minimal_config )
633
633
build = BuildConfigV1 (
634
634
{},
@@ -642,7 +642,7 @@ def it_works_on_python_validation(self, tmpdir):
642
642
build .validate_build ()
643
643
build .validate_python ()
644
644
645
- def it_works (self , tmpdir ):
645
+ def test_it_works (self , tmpdir ):
646
646
apply_fs (tmpdir , minimal_config )
647
647
build = BuildConfigV1 (
648
648
get_env_config (),
@@ -653,7 +653,7 @@ def it_works(self, tmpdir):
653
653
build .validate ()
654
654
assert build .build .image == 'readthedocs/build:latest'
655
655
656
- def default (self , tmpdir ):
656
+ def test_default (self , tmpdir ):
657
657
apply_fs (tmpdir , minimal_config )
658
658
build = BuildConfigV1 (
659
659
get_env_config (),
@@ -666,7 +666,7 @@ def default(self, tmpdir):
666
666
667
667
@pytest .mark .parametrize (
668
668
'image' , ['latest' , 'readthedocs/build:3.0' , 'rtd/build:latest' ])
669
- def it_priorities_image_from_env_config (self , tmpdir , image ):
669
+ def test_it_priorities_image_from_env_config (self , tmpdir , image ):
670
670
apply_fs (tmpdir , minimal_config )
671
671
defaults = {
672
672
'build_image' : image ,
0 commit comments