Skip to content

Commit 8728273

Browse files
committed
fix: define dummy values when Rust extension unavailable
Without defining rust_dicttoxml, escape_xml_py, and wrap_cdata_py when ImportError occurs, the test module fails to import entirely, resulting in "collected 0 items" instead of properly skipped tests.
1 parent 9564a83 commit 8728273

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_rust_dicttoxml.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
RUST_AVAILABLE = True
1616
except ImportError:
1717
RUST_AVAILABLE = False
18+
# Define dummy functions so tests can be collected (they'll be skipped anyway)
19+
rust_dicttoxml = None # type: ignore[assignment]
20+
escape_xml_py = None # type: ignore[assignment]
21+
wrap_cdata_py = None # type: ignore[assignment]
1822

1923
import json2xml.dicttoxml_fast as fast_module
2024
from json2xml import dicttoxml as py_dicttoxml

0 commit comments

Comments
 (0)