@@ -180,7 +180,7 @@ def subprocess(self, argv, out, data=None):
180
180
def setup (self ):
181
181
if not hasattr (str , 'format' ):
182
182
# A large part of this functionality is not available on Python 2.5
183
- pytest .skip ()
183
+ pytest .skip ("test not for py 2.5" )
184
184
self .patcher = patch ('subprocess.Popen' )
185
185
self .popen = self .patcher .start ()
186
186
self .popen .return_value = Mock ()
@@ -480,41 +480,35 @@ def test_cssmin(self):
480
480
self .mkbundle ('foo.css' , filters = 'cssmin' , output = 'out.css' ).build ()
481
481
except EnvironmentError :
482
482
# cssmin is not installed, that's ok.
483
- pytest .skip ()
483
+ pytest .skip ('no cssmin' )
484
484
assert self .get ('out.css' ) == """h1{font-family:"Verdana";color:#FFF}"""
485
485
486
486
def test_cssutils (self ):
487
- try :
488
- import cssutils
489
- except ImportError :
490
- pytest .skip ()
487
+ cssutils = pytest .importorskip ('cssutils' )
491
488
self .mkbundle ('foo.css' , filters = 'cssutils' , output = 'out.css' ).build ()
492
489
assert self .get ('out.css' ) == """h1{font-family:"Verdana";color:#FFF}"""
493
490
494
491
def test_clevercss (self ):
495
- try :
496
- import clevercss
497
- except ImportError :
498
- pytest .skip ()
492
+ clevercss = pytest .importorskip ('clevercss' )
499
493
self .create_files ({'in' : """a:\n color: #fff.darken(50%)""" })
500
494
self .mkbundle ('in' , filters = 'clevercss' , output = 'out.css' ).build ()
501
495
assert self .get ('out.css' ) == """a {\n color: #7f7f7f;\n }"""
502
496
503
497
def test_uglifyjs_ascii (self ):
504
498
if not find_executable ('uglifyjs' ):
505
- pytest .skip ()
499
+ pytest .skip ('no uglifyjs' )
506
500
self .mkbundle ('foo2.js' , filters = 'uglifyjs' , output = 'out.js' ).build ()
507
501
assert self .get ('out.js' ) == 'more();'
508
502
509
503
def test_uglifyjs_unicode (self ):
510
504
if not find_executable ('uglifyjs' ):
511
- pytest .skip ()
505
+ pytest .skip ('no uglifyjs' )
512
506
self .mkbundle ('foo.js' , filters = 'uglifyjs' , output = 'out.js' ).build ()
513
507
assert self .get ('out.js' ) == 'function foo(bar){var dummy;document.write(bar);var a="Ünícôdè"}'
514
508
515
509
def test_uglifyjs_ascii_and_unicode (self ):
516
510
if not find_executable ('uglifyjs' ):
517
- pytest .skip ()
511
+ pytest .skip ('no uglifyjs' )
518
512
self .mkbundle ('foo.js' , 'foo2.js' , filters = 'uglifyjs' , output = 'out.js' ).build ()
519
513
assert self .get ('out.js' ) == 'function foo(bar){var dummy;document.write(bar);var a="Ünícôdè"}more();'
520
514
@@ -547,10 +541,7 @@ def test_less_ruby(self):
547
541
assert self .get ('out.css' ) == 'h1 {\n font-family: "Verdana";\n color: #ffffff;\n }\n '
548
542
549
543
def test_jsmin (self ):
550
- try :
551
- import jsmin
552
- except ImportError :
553
- pytest .skip ()
544
+ jsmin = pytest .importorskip ('jsmin' )
554
545
self .mkbundle ('foo.js' , filters = 'jsmin' , output = 'out.js' ).build ()
555
546
assert self .get ('out.js' ) in (
556
547
# Builtin jsmin
@@ -562,10 +553,7 @@ def test_jsmin(self):
562
553
)
563
554
564
555
def test_rjsmin (self ):
565
- try :
566
- import rjsmin
567
- except ImportError :
568
- pytest .skip ()
556
+ rjsmin = pytest .importorskip ('rjsmin' )
569
557
self .mkbundle ('foo.js' , filters = 'rjsmin' , output = 'out.js' ).build ()
570
558
assert self .get ('out.js' ) == 'function foo(bar){var dummy;document.write(bar);var a="\xc3 \x9c n\xc3 \xad c\xc3 \xb4 d\xc3 \xa8 ";}'
571
559
@@ -574,38 +562,29 @@ def test_jspacker(self):
574
562
assert self .get ('out.js' ).startswith ('eval(function(p,a,c,k,e,d)' )
575
563
576
564
def test_yui_js (self ):
577
- try :
578
- import yuicompressor
579
- except ImportError :
580
- pytest .skip ()
565
+ yuicompressor = pytest .importorskip ('yuicompressor' )
581
566
self .mkbundle ('foo.js' , filters = 'yui_js' , output = 'out.js' ).build ()
582
567
assert self .get ('out.js' ) == 'function foo(c){var d;document.write(c);var b="Ünícôdè"};'
583
568
584
569
def test_yui_css (self ):
585
- try :
586
- import yuicompressor
587
- except ImportError :
588
- pytest .skip ()
570
+ yuicompressor = pytest .importorskip ('yuicompressor' )
589
571
self .mkbundle ('foo.css' , filters = 'yui_css' , output = 'out.css' ).build ()
590
572
assert self .get ('out.css' ) == """h1{font-family:"Verdana";color:#fff}"""
591
573
592
574
def test_cleancss (self ):
593
575
if not find_executable ('cleancss' ):
594
- pytest .skip ()
576
+ pytest .skip ('no cleancss' )
595
577
self .mkbundle ('foo.css' , filters = 'cleancss' , output = 'out.css' ).build ()
596
578
assert self .get ('out.css' ) in ('h1{font-family:Verdana;color:#FFF}' , 'h1{font-family:Verdana;color:#fff}' )
597
579
598
580
def test_cssslimmer (self ):
599
- try :
600
- import slimmer
601
- except ImportError :
602
- pytest .skip ()
581
+ slimmer = pytest .importorskip ('slimmer' )
603
582
self .mkbundle ('foo.css' , filters = 'css_slimmer' , output = 'out.css' ).build ()
604
583
assert self .get ('out.css' ) == 'h1{font-family:"Verdana";color:#FFF}'
605
584
606
585
def test_stylus (self ):
607
586
if not find_executable ('stylus' ):
608
- pytest .skip ()
587
+ pytest .skip ('no stylus' )
609
588
self .create_files ({'in' : """a\n width:100px\n height:(@width/2)""" })
610
589
self .mkbundle ('in' , filters = 'stylus' , output = 'out.css' ).build ()
611
590
assert self .get ('out.css' ) == """a {\n width: 100px;\n height: 50px;\n }\n \n """
@@ -614,7 +593,7 @@ def test_rcssmin(self):
614
593
try :
615
594
self .mkbundle ('foo.css' , filters = 'rcssmin' , output = 'out.css' ).build ()
616
595
except EnvironmentError :
617
- pytest .skip ()
596
+ pytest .skip ('no rcssmin' )
618
597
assert self .get ('out.css' ) == """h1{font-family:"Verdana";color:#FFFFFF}"""
619
598
620
599
def test_find_pyc_files ( self ):
@@ -631,10 +610,7 @@ def test_find_packages( self ):
631
610
class TestCSSPrefixer (TempEnvironmentHelper ):
632
611
633
612
def setup (self ):
634
- try :
635
- import cssprefixer
636
- except ImportError :
637
- pytest .skip ()
613
+ cssprefixer = pytest .importorskip ('cssprefixer' )
638
614
TempEnvironmentHelper .setup (self )
639
615
640
616
def test (self ):
@@ -652,7 +628,7 @@ class TestCoffeeScript(TempEnvironmentHelper):
652
628
653
629
def setup (self ):
654
630
if not find_executable ('coffee' ):
655
- pytest .skip ()
631
+ pytest .skip ('no coffee' )
656
632
TempEnvironmentHelper .setup (self )
657
633
658
634
def test_default_options (self ):
@@ -675,10 +651,7 @@ def test_bare_option(self):
675
651
class TestJinja2 (TempEnvironmentHelper ):
676
652
677
653
def setup (self ):
678
- try :
679
- import jinja2
680
- except ImportError :
681
- pytest .skip ()
654
+ jinja2 = pytest .importorskip ('jinja' )
682
655
TempEnvironmentHelper .setup (self )
683
656
684
657
def test_default_options (self ):
@@ -706,11 +679,7 @@ class TestClosure(TempEnvironmentHelper):
706
679
}
707
680
708
681
def setup (self ):
709
- try :
710
- import closure
711
- except ImportError :
712
- pytest .skip ()
713
-
682
+ closure = pytest .importorskip ('closure' )
714
683
TempEnvironmentHelper .setup (self )
715
684
716
685
def test_closure (self ):
@@ -834,7 +803,7 @@ class TestLess(TempEnvironmentHelper):
834
803
835
804
def setup (self ):
836
805
if not find_executable ('lessc' ):
837
- pytest .skip ()
806
+ pytest .skip ('no lessc' )
838
807
TempEnvironmentHelper .setup (self )
839
808
840
809
def test (self ):
@@ -930,10 +899,10 @@ class TestRubySass(TempEnvironmentHelper):
930
899
931
900
def setup (self ):
932
901
if not find_executable ('sass' ):
933
- pytest .skip ()
902
+ pytest .skip ('no sass' )
934
903
935
904
if "Ruby" not in check_output (["sass" , "--version" ]).decode ('utf-8' ):
936
- pytest .skip ()
905
+ pytest .skip ('no Ruby' )
937
906
938
907
TempEnvironmentHelper .setup (self )
939
908
@@ -1040,7 +1009,7 @@ class TestSass(TempEnvironmentHelper):
1040
1009
1041
1010
def setup (self ):
1042
1011
if not find_executable ('sass' ):
1043
- pytest .skip ()
1012
+ pytest .skip ('no sass' )
1044
1013
TempEnvironmentHelper .setup (self )
1045
1014
1046
1015
def test_sass (self ):
@@ -1104,7 +1073,7 @@ def setup(self):
1104
1073
import scss
1105
1074
self .scss = scss
1106
1075
except ImportError :
1107
- pytest .skip ()
1076
+ pytest .skip ('no scss' )
1108
1077
TempEnvironmentHelper .setup (self )
1109
1078
1110
1079
def test (self ):
@@ -1119,7 +1088,7 @@ def test_assets(self):
1119
1088
from PIL import Image
1120
1089
Image .new ('RGB' , (10 ,10 )).save (StringIO (), 'png' )
1121
1090
except (ImportError , IOError ):
1122
- pytest .skip ()
1091
+ pytest .skip ('no PIL or Pillow' )
1123
1092
self .create_files ({'noise.scss' : 'h1 {background: background-noise()}' })
1124
1093
self .mkbundle ('noise.scss' , filters = 'pyscss' , output = 'out.css' ).build ()
1125
1094
@@ -1141,7 +1110,7 @@ def setup(self):
1141
1110
import sass
1142
1111
self .sass = sass
1143
1112
except ImportError :
1144
- pytest .skip ()
1113
+ pytest .skip ('no sass' )
1145
1114
TempEnvironmentHelper .setup (self )
1146
1115
1147
1116
def test (self ):
@@ -1200,7 +1169,7 @@ class TestCompass(TempEnvironmentHelper):
1200
1169
1201
1170
def setup (self ):
1202
1171
if not find_executable ('compass' ):
1203
- pytest .skip ()
1172
+ pytest .skip ('no compass' )
1204
1173
TempEnvironmentHelper .setup (self )
1205
1174
1206
1175
def test_compass (self ):
@@ -1426,7 +1395,7 @@ class TestHandlebars(TempEnvironmentHelper):
1426
1395
1427
1396
def setup (self ):
1428
1397
if not find_executable ('handlebars' ):
1429
- pytest .skip ()
1398
+ pytest .skip ('no handlebars' )
1430
1399
TempEnvironmentHelper .setup (self )
1431
1400
1432
1401
def test_basic (self ):
@@ -1462,10 +1431,7 @@ class TestJinja2JS(TempEnvironmentHelper):
1462
1431
}
1463
1432
1464
1433
def setup (self ):
1465
- try :
1466
- import closure_soy
1467
- except :
1468
- pytest .skip ()
1434
+ closure_soy = pytest .importorskip ('closure_soy' )
1469
1435
TempEnvironmentHelper .setup (self )
1470
1436
1471
1437
def test (self ):
@@ -1492,7 +1458,7 @@ class TestTypeScript(TempEnvironmentHelper):
1492
1458
1493
1459
def setup (self ):
1494
1460
if not find_executable ('tsc' ):
1495
- pytest .skip ()
1461
+ pytest .skip ('no tsc' )
1496
1462
TempEnvironmentHelper .setup (self )
1497
1463
1498
1464
def test (self ):
@@ -1575,7 +1541,7 @@ class TestClosureStylesheets(TempEnvironmentHelper):
1575
1541
1576
1542
def setup (self ):
1577
1543
if not 'CLOSURE_STYLESHEETS_PATH' in os .environ :
1578
- pytest .skip ()
1544
+ pytest .skip ('no CLOSURE_STYLESHEETS_PATH in env' )
1579
1545
TempEnvironmentHelper .setup (self )
1580
1546
1581
1547
def test_compiler (self ):
@@ -1602,7 +1568,7 @@ def test_first(self):
1602
1568
except FilterError as e :
1603
1569
# postcss is not installed, that's ok.
1604
1570
if 'Program file not found' in e .message :
1605
- pytest .skip ()
1571
+ pytest .skip (e . message )
1606
1572
else :
1607
1573
raise
1608
1574
out = self .get ('output.css' )
@@ -1621,7 +1587,7 @@ def test_es2015(self):
1621
1587
except FilterError as e :
1622
1588
# babel is not installed, that's ok.
1623
1589
if 'Program file not found' in str (e ):
1624
- pytest .skip ()
1590
+ pytest .skip (e . message )
1625
1591
else :
1626
1592
raise
1627
1593
assert "var x = function x" in self .get ('output.js' )
@@ -1633,7 +1599,7 @@ def test_extra_args(self):
1633
1599
except FilterError as e :
1634
1600
# babel is not installed, that's ok.
1635
1601
if 'Program file not found' in e .message :
1636
- pytest .skip ()
1602
+ pytest .skip (e . message )
1637
1603
else :
1638
1604
raise
1639
1605
assert (self .get ('output.js' ).strip () ==
0 commit comments