code: def pytest_configure(config):
      """Pytest configuration hook to help reproduce test segfaults
  
      Sets and outputs rng seeds.
  
      The segfault-debug procedure on a module called test_module.py is:
  
      1. run "pytest --verbose test_module.py".  A seg-faulting output might be:
  
         [INFO] np, mx and python random seeds = 4018804151
         test_module.test1 ... ok
         test_module.test2 ... Illegal instruction (core dumped)
  
      2. Copy the module-starting seed into the next command, then run:
  
         MXNET_MODULE_SEED=4018804151 pytest --log-level=DEBUG --verbose test_module.py
  
         Output might be:
  
         [WARNING] **** module-level seed is set: all tests running deterministically ****
         [INFO] np, mx and python random seeds = 4018804151
         test_module.test1 ... [DEBUG] np and mx random seeds = 3935862516
         ok
         test_module.test2 ... [DEBUG] np and mx random seeds = 1435005594
         Illegal instruction (core dumped)
  
      3. Copy the segfaulting-test seed into the command:
         MXNET_TEST_SEED=1435005594 pytest --log-level=DEBUG --verbose test_module.py:test2
         Output might be:
  
         [INFO] np, mx and python random seeds = 2481884723
         test_module.test2 ... [DEBUG] np and mx random seeds = 1435005594
         Illegal instruction (core dumped)
  
      3. Finally reproduce the segfault directly under gdb (might need additional os packages)
         by editing the bottom of test_module.py to be
  
         if __name__ == '__main__':
             logging.getLogger().setLevel(logging.DEBUG)
             test2()
  
         MXNET_TEST_SEED=1435005594 gdb -ex r --args python test_module.py
  
      4. When finished debugging the segfault, remember to unset any exported MXNET_ seed
         variables in the environment to return to non-deterministic testing (a good thing).
      """
      config.addinivalue_line(
          "markers", "slow: mark test as slow to run"
      )
  
      module_seed_str = os.getenv("MXNET_MODULE_SEED")
      if module_seed_str is None:
          seed = np.random.randint(0, np.iinfo(np.int32).max)
      else:
          seed = int(module_seed_str)
          logging.warning(
              "*** module-level seed is set: "
              "all tests running deterministically ***"
          )
      print(
          "Setting module np/mx/python random seeds, "
          "use MXNET_MODULE_SEED={} to reproduce.".format(seed)
      )
  
      np.random.seed(seed)
      mx.npx.random.seed(seed)
      random.seed(seed)
  
      # The MXNET_TEST_SEED environment variable will override MXNET_MODULE_SEED for tests with
      #  the 'with_seed()' decoration.  Inform the user of this once here at the module level.
      if os.getenv("MXNET_TEST_SEED") is not None:
          logging.warning(
              '*** test-level seed set: all "@with_seed()" '
              "tests run deterministically ***"
          )
  
file_path: gluon-nlp/conftest.py
imports: import logging
  import os
  import random
  import numpy
  import mxnet
  import gluonnlp
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: pytest_configure(config) without return types