MCPcopy Create free account
hub / github.com/numpy/numpy / test_variable_too_long

Method test_variable_too_long

numpy/core/tests/test_cpu_features.py:254–267  ·  view source on GitHub ↗

Test that an error is thrown if the environment variables are too long to be processed. Current limit is 1024, but this may change later.

(self, action)

Source from the content-addressed store, hash-verified

252 )
253 @pytest.mark.parametrize("action", ["ENABLE", "DISABLE"])
254 def test_variable_too_long(self, action):
255 """
256 Test that an error is thrown if the environment variables are too long
257 to be processed. Current limit is 1024, but this may change later.
258 """
259 MAX_VAR_LENGTH = 1024
260 # Actual length is MAX_VAR_LENGTH + 1 due to null-termination
261 self.env[f'NPY_{action}_CPU_FEATURES'] = "t" * MAX_VAR_LENGTH
262 msg = (
263 f"Length of environment variable 'NPY_{action}_CPU_FEATURES' is "
264 f"{MAX_VAR_LENGTH + 1}, only {MAX_VAR_LENGTH} accepted"
265 )
266 err_type = "RuntimeError"
267 self._expect_error(msg, err_type)
268
269 @pytest.mark.skipif(
270 not __cpu_dispatch__,

Callers

nothing calls this directly

Calls 1

_expect_errorMethod · 0.95

Tested by

no test coverage detected