code: def pushd(dir):
      """
      >>> tmp_path = getfixture('tmp_path')
      >>> with pushd(tmp_path):
      ...     assert os.getcwd() == os.fspath(tmp_path)
      >>> assert os.getcwd() != os.fspath(tmp_path)
      """
  
      orig = os.getcwd()
      os.chdir(dir)
      try:
          yield dir
      finally:
          os.chdir(orig)
  
imports: import os
  import subprocess
  import contextlib
  import functools
  import tempfile
  import shutil
  import operator
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: pushd(dir) without return types