File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,5 @@ doctest_optionflags="NUMBER NORMALIZE_WHITESPACE ELLIPSIS"
32
32
doctest_glob =" **/*.md"
33
33
markers = [
34
34
" flash_attn_test: marks tests related to flash attention (deselect with '-m \" not flash_attn_test\" ')" ,
35
+ " bitsandbytes: select (or deselect with `not`) bitsandbytes integration tests" ,
35
36
]
Original file line number Diff line number Diff line change @@ -966,9 +966,17 @@ def require_aqlm(test_case):
966
966
967
967
def require_bitsandbytes (test_case ):
968
968
"""
969
- Decorator for bits and bytes (bnb) dependency
969
+ Decorator marking a test that requires the bitsandbytes library. Will be skipped when the library or its hard dependency torch is not installed.
970
970
"""
971
- return unittest .skipUnless (is_bitsandbytes_available (), "test requires bnb" )(test_case )
971
+ if is_bitsandbytes_available () and is_torch_available ():
972
+ try :
973
+ import pytest
974
+
975
+ return pytest .mark .bitsandbytes (test_case )
976
+ except ImportError :
977
+ return test_case
978
+ else :
979
+ return unittest .skip ("test requires bitsandbytes and torch" )(test_case )
972
980
973
981
974
982
def require_optimum (test_case ):
You can’t perform that action at this time.
0 commit comments