Skip to content

back to SWE-Agent summary

SWE-Agent: tornado

Pytest Summary for test test

status count
failed 7
total 7
collected 7
passed 0

Failed pytests:

autoreload_test.py::AutoreloadTest::test_reload

autoreload_test.py::AutoreloadTest::test_reload
self = 

        def test_reload(self):
            main = """\
    import sys

    # In module mode, the path is set to the parent directory and we can import testapp.
    try:
        import testapp
    except ImportError:
        print("import testapp failed")
    else:
        print("import testapp succeeded")

    spec = getattr(sys.modules[__name__], '__spec__', None)
    print(f"Starting {__name__=}, __spec__.name={getattr(spec, 'name', None)}")
    exec(open("run_twice_magic.py").read())
    """

            # Create temporary test application
            self.write_files(
                {
                    "testapp": {
                        "__init__.py": "",
                        "__main__.py": main,
                    },
                }
            )

            # The autoreload wrapper should support all the same modes as the python interpreter.
            # The wrapper itself should have no effect on this test so we try all modes with and
            # without it.
            for wrapper in [False, True]:
                with self.subTest(wrapper=wrapper):
                    with self.subTest(mode="module"):
                        if wrapper:
                            base_args = [sys.executable, "-m", "tornado.autoreload"]
                        else:
                            base_args = [sys.executable]
                        # In module mode, the path is set to the parent directory and we can import
                        # testapp. Also, the __spec__.name is set to the fully qualified module name.
>                       out = self.run_subprocess(base_args + ["-m", "testapp"])

tornado/test/autoreload_test.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tornado/test/autoreload_test.py:100: in run_subprocess
    self.assertEqual(p.returncode, 0)
E   AssertionError: 1 != 0

autoreload_test.py::AutoreloadTest::test_reload_wrapper_args

autoreload_test.py::AutoreloadTest::test_reload_wrapper_args
self = 

        def test_reload_wrapper_args(self):
            main = """\
    import os
    import sys

    print(os.path.basename(sys.argv[0]))
    print(f'argv={sys.argv[1:]}')
    exec(open("run_twice_magic.py").read())
    """
            # Create temporary test application
            self.write_files({"main.py": main})

            # Make sure the tornado module under test is available to the test
            # application
>           out = self.run_subprocess(
                [
                    sys.executable,
                    "-m",
                    "tornado.autoreload",
                    "main.py",
                    "arg1",
                    "--arg2",
                    "-m",
                    "arg3",
                ],
            )

tornado/test/autoreload_test.py:229: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tornado/test/autoreload_test.py:100: in run_subprocess
    self.assertEqual(p.returncode, 0)
E   AssertionError: 1 != 0

autoreload_test.py::AutoreloadTest::test_reload_wrapper_preservation

autoreload_test.py::AutoreloadTest::test_reload_wrapper_preservation
self = 

        def test_reload_wrapper_preservation(self):
            # This test verifies that when `python -m tornado.autoreload`
            # is used on an application that also has an internal
            # autoreload, the reload wrapper is preserved on restart.
            main = """\
    import sys

    # This import will fail if path is not set up correctly
    import testapp

    if 'tornado.autoreload' not in sys.modules:
        raise Exception('started without autoreload wrapper')

    print('Starting')
    exec(open("run_twice_magic.py").read())
    """

            self.write_files(
                {
                    "testapp": {
                        "__init__.py": "",
                        "__main__.py": main,
                    },
                }
            )

>           out = self.run_subprocess(
                [sys.executable, "-m", "tornado.autoreload", "-m", "testapp"]
            )

tornado/test/autoreload_test.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tornado/test/autoreload_test.py:100: in run_subprocess
    self.assertEqual(p.returncode, 0)
E   AssertionError: 1 != 0

autoreload_test.py::AutoreloadTest::test_reload_wrapper_until_success

autoreload_test.py::AutoreloadTest::test_reload_wrapper_until_success
self = 

        def test_reload_wrapper_until_success(self):
            main = """\
    import os
    import sys

    if "TESTAPP_STARTED" in os.environ:
        print("exiting cleanly")
        sys.exit(0)
    else:
        print("reloading")
        exec(open("run_twice_magic.py").read())
    """

            # Create temporary test application
            self.write_files({"main.py": main})

>           out = self.run_subprocess(
                [sys.executable, "-m", "tornado.autoreload", "--until-success", "main.py"]
            )

tornado/test/autoreload_test.py:260: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tornado/test/autoreload_test.py:100: in run_subprocess
    self.assertEqual(p.returncode, 0)
E   AssertionError: 1 != 0

import_test.py::ImportTest::test_import_aliases

import_test.py::ImportTest::test_import_aliases
self = 

    def test_import_aliases(self):
        # Ensure we don't delete formerly-documented aliases accidentally.
        import tornado
        import asyncio

>       self.assertIs(tornado.ioloop.TimeoutError, tornado.util.TimeoutError)

tornado/test/import_test.py:63: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tornado/__init__.py:66: in __getattr__
    return importlib.import_module("." + name, __name__)
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
:1050: in _gcd_import
    ???
:1027: in _find_and_load
    ???
:1006: in _find_and_load_unlocked
    ???
:688: in _load_unlocked
    ???
:883: in exec_module
    ???
:241: in _call_with_frames_removed
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    """An I/O event loop for non-blocking sockets.

    In Tornado 6.0, `.IOLoop` is a wrapper around the `asyncio` event loop, with a
    slightly different interface. The `.IOLoop` interface is now provided primarily
    for backwards compatibility; new code should generally use the `asyncio` event
    loop interface directly. The `IOLoop.current` class method provides the
    `IOLoop` instance corresponding to the running `asyncio` event loop.

    """
    import asyncio
    import concurrent.futures
    import datetime
    import functools
    import numbers
    import os
    import sys
    import time
    import math
    import random
    import warnings
    from inspect import isawaitable
>   from tornado.concurrent import Future, is_future, chain_future, future_set_exc_info, future_add_done_callback
E     File "/testbed/tornado/concurrent.py", line 30
E       dummy_executor = DummyExecutor()
E   IndentationError: expected an indented block after 'if' statement on line 29

tornado/ioloop.py:22: IndentationError

import_test.py::ImportTest::test_import_everything

import_test.py::ImportTest::test_import_everything
self = 

    def test_import_everything(self):
        # Test that all Tornado modules can be imported without side effects,
        # specifically without initializing the default asyncio event loop.
        # Since we can't tell which modules may have already beein imported
        # in our process, do it in a subprocess for a clean slate.
        proc = subprocess.Popen([sys.executable], stdin=subprocess.PIPE)
        proc.communicate(_import_everything)
>       self.assertEqual(proc.returncode, 0)
E       AssertionError: 1 != 0

tornado/test/import_test.py:50: AssertionError

import_test.py::ImportTest::test_lazy_import

import_test.py::ImportTest::test_lazy_import
self = 

    def test_lazy_import(self):
        # Test that submodules can be referenced lazily after "import tornado"
        proc = subprocess.Popen([sys.executable], stdin=subprocess.PIPE)
        proc.communicate(_import_lazy)
>       self.assertEqual(proc.returncode, 0)
E       AssertionError: 1 != 0

tornado/test/import_test.py:56: AssertionError

Patch diff