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)
| 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__, |
nothing calls this directly
no test coverage detected