Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add WebSockets support #59

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

feat: add WebSockets support #59

wants to merge 3 commits into from

Conversation

michalc
Copy link
Member

@michalc michalc commented Jan 8, 2025

No description provided.

@michalc michalc marked this pull request as draft January 8, 2025 15:47
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2025

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
107 4 103 1
View the top 3 failed tests by shortest run time
tests/test_main.py::LoggingTestCase::test_asim_formatter_get_log_dict
Stack Traces | 0.001s run time
self = <tests.test_main.LoggingTestCase testMethod=test_asim_formatter_get_log_dict>

    def test_asim_formatter_get_log_dict(self):
        formatter = ASIMFormatter()
        log_record = logging.LogRecord(
            name=__name__,
            level=logging.INFO,
            pathname=__file__,
            lineno=10,
            msg="This is a test log message",
            args=(),
            exc_info=None,
        )
        log_time = datetime.utcfromtimestamp(log_record.created).isoformat()
    
>       log_dict = formatter.get_log_dict(log_record)

tests/test_main.py:2314: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
asim_formatter.py:51: in get_log_dict
    "IpFilterVersion": get_package_version(),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def get_package_version() -> str:
        # importing here, to avoid circular import error
        from main import app
>       from main import cache
E       ImportError: cannot import name 'cache' from 'main' (.../ip-filter/ip-filter/main.py)

utils.py:20: ImportError
tests/test_main.py::LoggingTestCase::test_get_package_version_cache
Stack Traces | 0.001s run time
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1393: in patched
    with self.decoration_helper(patched,
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/contextlib.py:137: in __enter__
    return next(self.gen)
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1375: in decoration_helper
    arg = exit_stack.enter_context(patching)
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/contextlib.py:526: in enter_context
    result = _enter(cm)
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1467: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f90658dac90>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <module 'main' from '.../ip-filter/ip-filter/main.py'> does not have the attribute 'cache'

.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1437: AttributeError
tests/test_main.py::LoggingTestCase::test_get_package_version_no_cache
Stack Traces | 0.001s run time
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1393: in patched
    with self.decoration_helper(patched,
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/contextlib.py:137: in __enter__
    return next(self.gen)
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1375: in decoration_helper
    arg = exit_stack.enter_context(patching)
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/contextlib.py:526: in enter_context
    result = _enter(cm)
.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1467: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f90658e2360>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <module 'main' from '.../ip-filter/ip-filter/main.py'> does not have the attribute 'cache'

.../hostedtoolcache/Python/3.12.8................../x64/lib/python3.12/unittest/mock.py:1437: AttributeError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

In a later commit we're moving away from Flask to aiohttp, so depending less on
Flask should make that change a bit easier.
As far as I can see, Flask caching isn't used anywhere. And in a later commit,
we're moving to aiohttp, so depending less on Flask should make that change a
bit easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants