3
3
4
4
import collections
5
5
import contextlib
6
+ import functools
6
7
import glob
7
8
import json
8
9
import os
@@ -904,7 +905,26 @@ def __eq__(self, other):
904
905
return bool (self .reg .match (other ))
905
906
906
907
908
+ def skipif (cond , message ):
909
+ def decorator (func ):
910
+ @functools .wraps (func )
911
+ def inner (* args , ** kwargs ):
912
+ if cond :
913
+ print (message )
914
+ else :
915
+ return func (* args , ** kwargs )
916
+ return inner
917
+ return decorator
918
+
919
+
920
+ # TODO FIXME: https://github.com/sass/libsass/issues/875
921
+ skipif_windows_errors_are_broken = skipif (
922
+ os .name == 'nt' , 'SKIPPED: errors are broken on windows :(' ,
923
+ )
924
+
925
+
907
926
class CustomFunctionsTest (unittest .TestCase ):
927
+ @skipif_windows_errors_are_broken
908
928
def test_raises (self ):
909
929
with assert_raises_compile_error (RegexMatcher (
910
930
r'^stdin:(0|1): error in C function raises: \n'
@@ -917,6 +937,7 @@ def test_raises(self):
917
937
)):
918
938
compile_with_func ('a { content: raises(); }' )
919
939
940
+ @skipif_windows_errors_are_broken
920
941
def test_warning (self ):
921
942
with assert_raises_compile_error (RegexMatcher (
922
943
r'^stdin:(0|1): warning in C function returns-warning: '
@@ -927,6 +948,7 @@ def test_warning(self):
927
948
)):
928
949
compile_with_func ('a { content: returns_warning(); }' )
929
950
951
+ @skipif_windows_errors_are_broken
930
952
def test_error (self ):
931
953
with assert_raises_compile_error (RegexMatcher (
932
954
r'^stdin:(0|1): error in C function returns-error: '
@@ -937,6 +959,7 @@ def test_error(self):
937
959
)):
938
960
compile_with_func ('a { content: returns_error(); }' )
939
961
962
+ @skipif_windows_errors_are_broken
940
963
def test_returns_unknown_object (self ):
941
964
with assert_raises_compile_error (RegexMatcher (
942
965
r'^stdin:(0|1): error in C function returns-unknown: '
0 commit comments