Unverified Commit 1e402b95 authored by Titus's avatar Titus Committed by GitHub
Browse files

add test marker to run all tests with @require_bitsandbytes (#28278)

parent f3aa7db4
...@@ -32,4 +32,5 @@ doctest_optionflags="NUMBER NORMALIZE_WHITESPACE ELLIPSIS" ...@@ -32,4 +32,5 @@ doctest_optionflags="NUMBER NORMALIZE_WHITESPACE ELLIPSIS"
doctest_glob="**/*.md" doctest_glob="**/*.md"
markers = [ markers = [
"flash_attn_test: marks tests related to flash attention (deselect with '-m \"not flash_attn_test\"')", "flash_attn_test: marks tests related to flash attention (deselect with '-m \"not flash_attn_test\"')",
"bitsandbytes: select (or deselect with `not`) bitsandbytes integration tests",
] ]
\ No newline at end of file
...@@ -966,9 +966,17 @@ def require_aqlm(test_case): ...@@ -966,9 +966,17 @@ def require_aqlm(test_case):
def require_bitsandbytes(test_case): def require_bitsandbytes(test_case):
""" """
Decorator for bits and bytes (bnb) dependency Decorator marking a test that requires the bitsandbytes library. Will be skipped when the library or its hard dependency torch is not installed.
""" """
return unittest.skipUnless(is_bitsandbytes_available(), "test requires bnb")(test_case) if is_bitsandbytes_available() and is_torch_available():
try:
import pytest
return pytest.mark.bitsandbytes(test_case)
except ImportError:
return test_case
else:
return unittest.skip("test requires bitsandbytes and torch")(test_case)
def require_optimum(test_case): def require_optimum(test_case):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment