Skip to content

Bug: SMTP throws AttributeError on teardown #53

Closed
@henri-hulski

Description

@henri-hulski

It seems smtp server isn't compatible anymore with the recent aiosmtpd vesrsion.
I'm getting the following error when teardown the smtp server. Before everything worked fine.

______________________________ ERROR at teardown of test_admin_permissions ______________________________

    @pytest.fixture(scope="session")
    def smtp_server():
        from pytest_localserver import smtp
    
        port = 3377
        server = smtp.Server(port=port)
        server.start()
        yield server
>       server.stop()

myapplication/tests/conftest.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <smtp.Server 127.0.0.1:3377>, timeout = None

    def stop(self, timeout=None):
        """
        Stops test server.
        :param timeout: When the timeout argument is present and not None, it
        should be a floating point number specifying a timeout for the
        operation in seconds (or fractions thereof).
        """
    
        # This mostly copies the implementation from Controller.stop(), with two
        # differences:
        # - It removes the assertion that the thread exists, allowing stop() to
        #   be called more than once safely
        # - It passes the timeout argument to Thread.join()
        if self.loop.is_running():
>           self.loop.call_soon_threadsafe(self._stop)
E           AttributeError: 'Server' object has no attribute '_stop'

__pypackages__/3.9/lib/pytest_localserver/smtp.py:133: AttributeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions