old_contents: """Test setup.py."""
  
  
  import os
  import subprocess
  import sys
  
  
  def test_setup():
      """Run setup.py check."""
      command = [sys.executable, 'setup.py', 'check', '--metadata', '--strict']
      assert subprocess.run(command).returncode == 0
  
  
  def test_console_scripts():
      """Ensure console scripts were installed correctly."""
      assert any(
          os.path.isfile(os.path.join(directory, 'keysmith'))
          for directory in sys.path
      )
  
new_contents: """Test setup.py."""
  
  
  import os
  import subprocess
  import sys
  
  
  def test_setup():
      """Run setup.py check."""
      command = [sys.executable, 'setup.py', 'check', '--metadata', '--strict']
      assert subprocess.run(command).returncode == 0
  
  
  def test_console_scripts():
      """Ensure console scripts were installed correctly."""
      assert any(
          os.path.isfile(os.path.join(directory, 'keysmith'))
          for directory in os.environ['PATH'].split(':')
      )
  
subject: Use os.environ['PATH'] instead of sys.path