File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,7 +70,13 @@ def __dir__() -> list[str]:
7070}
7171
7272
73- _32_BIT_INTERPRETER = struct .calcsize ("P" ) == 4
73+ # This function can be unit tested without reloading the module
74+ # (Unlike _32_BIT_INTERPRETER)
75+ def _compute_32_bit_interpreter () -> bool :
76+ return struct .calcsize ("P" ) == 4
77+
78+
79+ _32_BIT_INTERPRETER = _compute_32_bit_interpreter ()
7480
7581
7682class Tag :
Original file line number Diff line number Diff line change 1111 import ctypes
1212except ImportError :
1313 ctypes = None # type: ignore[assignment]
14- import importlib
1514import os
1615import pathlib
1716import pickle
@@ -1806,9 +1805,6 @@ def test_pyemscripten(
18061805
18071806
18081807class TestBitness :
1809- def teardown_method (self ) -> None :
1810- importlib .reload (tags )
1811-
18121808 @pytest .mark .parametrize (
18131809 ("maxsize" , "sizeof_voidp" , "expected" ),
18141810 [
@@ -1833,8 +1829,7 @@ def _calcsize(fmt: str) -> int:
18331829
18341830 monkeypatch .setattr (sys , "maxsize" , maxsize )
18351831 monkeypatch .setattr (struct , "calcsize" , _calcsize )
1836- importlib .reload (tags )
1837- assert expected == tags ._32_BIT_INTERPRETER
1832+ assert expected == tags ._compute_32_bit_interpreter ()
18381833
18391834
18401835def test_pickle () -> None :
You can’t perform that action at this time.
0 commit comments