code: def _run_test(args):
      initial_working_dir = os.getcwdu()
      module_parent = _get_module_root().parent
      logger.info("Changing directory to %s", module_parent)
      os.chdir(module_parent)
      test_dir = os.path.join(module_parent, "allennlp")
      logger.info("Running tests at %s", test_dir)
      if args.run_all:
          # TODO(nfliu): remove this when notebooks have been rewritten as markdown.
          exit_code = pytest.main(
              [test_dir, "--color=no", "-k", "not notebooks_test"]
          )
      else:
          exit_code = pytest.main(
              [
                  test_dir,
                  "--color=no",
                  "-k",
                  "not sniff_test and not notebooks_test",
                  "-m",
                  "not java",
              ]
          )
      # Change back to original working directory after running tests
      os.chdir(initial_working_dir)
      exit(exit_code)
  
file_path: magnitude/pymagnitude/third_party/allennlp/commands/test_install.py
imports: from __future__ import absolute_import
  import argparse
  import logging
  import os
  import pathlib
  import pytest
  import allennlp
  from allennlp.commands.subcommand import Subcommand
label_desc: Use image node_id 2 for calling a global function with example usage: _run_test(args) without return types