prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Rethinking and rewriting sunpy.self_test
  We are currently using astropy's test runner for `sunpy.self_test` this was really designed for setup.py and is therefore very full of features which are probably not needed for self_test.
  
  Before we (I) go deleting swathes of code as I love to do. What do we want to achieve with self test? Is a very slim wrapper around `pytest --pyargs sunpy` all we need?
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `sunpy/__init__.py`
  Content:
  ```
  1 """
  2 SunPy
  3 =====
  4 
  5 An open-source Python library for Solar Physics data analysis.
  6 
  7 * Homepage: https://sunpy.org
  8 * Documentation: https://docs.sunpy.org/en/stable/
  9 """
  10 import os
  11 import sys
  12 import logging
  13 
  14 from sunpy.tests.runner import SunPyTestRunner
  15 from sunpy.util import system_info
  16 from sunpy.util.config import load_config, print_config
  17 from sunpy.util.logger import _init_log
  18 from .version import version as __version__
  19 
  20 # Enforce Python version check during package import.
  21 __minimum_python_version__ = "3.7"
  22 
  23 
  24 class UnsupportedPythonError(Exception):
  25     """Running on an unsupported version of Python."""
  26 
  27 
  28 if sys.version_info < tuple(int(val) for val in __minimum_python_version__.split('.')):
  29     # This has to be .format to keep backwards compatibly.
  30     raise UnsupportedPythonError(
  31         "sunpy does not support Python < {}".format(__minimum_python_version__))
  32 
  33 
  34 def _get_bibtex():
  35     import textwrap
  36 
  37     # Set the bibtex entry to the article referenced in CITATION.rst
  38     citation_file = os.path.join(os.path.dirname(__file__), 'CITATION.rst')
  39 
  40     # Explicitly specify UTF-8 encoding in case the system's default encoding is problematic
  41     with open(citation_file, 'r', encoding='utf-8') as citation:
  42         # Extract the first bibtex block:
  43         ref = citation.read().partition(".. code:: bibtex\n\n")[2]
  44         lines = ref.split("\n")
  45         # Only read the lines which are indented
  46         lines = lines[:[l.startswith("    ") for l in lines].index(False)]
  47         ref = textwrap.dedent('\n'.join(lines))
  48     return ref
  49 
  50 
  51 __citation__ = __bibtex__ = _get_bibtex()
  52 
  53 self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))
  54 
  55 # Load user configuration
  56 config = load_config()
  57 
  58 log = _init_log(config=config)
  59 
  60 __all__ = ['config', 'self_test', 'system_info', 'print_config']
  61
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/sunpy/__init__.py b/sunpy/__init__.py
  --- a/sunpy/__init__.py
  +++ b/sunpy/__init__.py
  @@ -11,7 +11,7 @@
   import sys
   import logging
   
  -from sunpy.tests.runner import SunPyTestRunner
  +from sunpy.tests.self_test import self_test
   from sunpy.util import system_info
   from sunpy.util.config import load_config, print_config
   from sunpy.util.logger import _init_log
  @@ -50,8 +50,6 @@
   
   __citation__ = __bibtex__ = _get_bibtex()
   
  -self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))
  -
   # Load user configuration
   config = load_config()
  
verification_info: {"golden_diff": "diff --git a/sunpy/__init__.py b/sunpy/__init__.py\n--- a/sunpy/__init__.py\n+++ b/sunpy/__init__.py\n@@ -11,7 +11,7 @@\n import sys\n import logging\n \n-from sunpy.tests.runner import SunPyTestRunner\n+from sunpy.tests.self_test import self_test\n from sunpy.util import system_info\n from sunpy.util.config import load_config, print_config\n from sunpy.util.logger import _init_log\n@@ -50,8 +50,6 @@\n \n __citation__ = __bibtex__ = _get_bibtex()\n \n-self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))\n-\n # Load user configuration\n config = load_config()\n", "issue": "Rethinking and rewriting sunpy.self_test\nWe are currently using astropy's test runner for `sunpy.self_test` this was really designed for setup.py and is therefore very full of features which are probably not needed for self_test.\n\nBefore we (I) go deleting swathes of code as I love to do. What do we want to achieve with self test? Is a very slim wrapper around `pytest --pyargs sunpy` all we need?\n", "before_files": [{"content": "\"\"\"\nSunPy\n=====\n\nAn open-source Python library for Solar Physics data analysis.\n\n* Homepage: https://sunpy.org\n* Documentation: https://docs.sunpy.org/en/stable/\n\"\"\"\nimport os\nimport sys\nimport logging\n\nfrom sunpy.tests.runner import SunPyTestRunner\nfrom sunpy.util import system_info\nfrom sunpy.util.config import load_config, print_config\nfrom sunpy.util.logger import _init_log\nfrom .version import version as __version__\n\n# Enforce Python version check during package import.\n__minimum_python_version__ = \"3.7\"\n\n\nclass UnsupportedPythonError(Exception):\n    \"\"\"Running on an unsupported version of Python.\"\"\"\n\n\nif sys.version_info < tuple(int(val) for val in __minimum_python_version__.split('.')):\n    # This has to be .format to keep backwards compatibly.\n    raise UnsupportedPythonError(\n        \"sunpy does not support Python < {}\".format(__minimum_python_version__))\n\n\ndef _get_bibtex():\n    import textwrap\n\n    # Set the bibtex entry to the article referenced in CITATION.rst\n    citation_file = os.path.join(os.path.dirname(__file__), 'CITATION.rst')\n\n    # Explicitly specify UTF-8 encoding in case the system's default encoding is problematic\n    with open(citation_file, 'r', encoding='utf-8') as citation:\n        # Extract the first bibtex block:\n        ref = citation.read().partition(\".. code:: bibtex\\n\\n\")[2]\n        lines = ref.split(\"\\n\")\n        # Only read the lines which are indented\n        lines = lines[:[l.startswith(\"    \") for l in lines].index(False)]\n        ref = textwrap.dedent('\\n'.join(lines))\n    return ref\n\n\n__citation__ = __bibtex__ = _get_bibtex()\n\nself_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))\n\n# Load user configuration\nconfig = load_config()\n\nlog = _init_log(config=config)\n\n__all__ = ['config', 'self_test', 'system_info', 'print_config']\n", "path": "sunpy/__init__.py"}], "after_files": [{"content": "\"\"\"\nSunPy\n=====\n\nAn open-source Python library for Solar Physics data analysis.\n\n* Homepage: https://sunpy.org\n* Documentation: https://docs.sunpy.org/en/stable/\n\"\"\"\nimport os\nimport sys\nimport logging\n\nfrom sunpy.tests.self_test import self_test\nfrom sunpy.util import system_info\nfrom sunpy.util.config import load_config, print_config\nfrom sunpy.util.logger import _init_log\nfrom .version import version as __version__\n\n# Enforce Python version check during package import.\n__minimum_python_version__ = \"3.7\"\n\n\nclass UnsupportedPythonError(Exception):\n    \"\"\"Running on an unsupported version of Python.\"\"\"\n\n\nif sys.version_info < tuple(int(val) for val in __minimum_python_version__.split('.')):\n    # This has to be .format to keep backwards compatibly.\n    raise UnsupportedPythonError(\n        \"sunpy does not support Python < {}\".format(__minimum_python_version__))\n\n\ndef _get_bibtex():\n    import textwrap\n\n    # Set the bibtex entry to the article referenced in CITATION.rst\n    citation_file = os.path.join(os.path.dirname(__file__), 'CITATION.rst')\n\n    # Explicitly specify UTF-8 encoding in case the system's default encoding is problematic\n    with open(citation_file, 'r', encoding='utf-8') as citation:\n        # Extract the first bibtex block:\n        ref = citation.read().partition(\".. code:: bibtex\\n\\n\")[2]\n        lines = ref.split(\"\\n\")\n        # Only read the lines which are indented\n        lines = lines[:[l.startswith(\"    \") for l in lines].index(False)]\n        ref = textwrap.dedent('\\n'.join(lines))\n    return ref\n\n\n__citation__ = __bibtex__ = _get_bibtex()\n\n# Load user configuration\nconfig = load_config()\n\nlog = _init_log(config=config)\n\n__all__ = ['config', 'self_test', 'system_info', 'print_config']\n", "path": "sunpy/__init__.py"}]}