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

test_dirscanner not running #2747

Closed
Safihre opened this issue Dec 11, 2023 · 3 comments · Fixed by #2748
Closed

test_dirscanner not running #2747

Safihre opened this issue Dec 11, 2023 · 3 comments · Fixed by #2748
Labels

Comments

@Safihre
Copy link
Member

Safihre commented Dec 11, 2023

SABnzbd version

develop

Operating system

CI

Using Docker image

None

Description

@mnightingale For some reason the test_dirscanner tests are all being ignored with super weird reasoning:

tests/test_dirscanner.py::TestDirScanner::test_adds_valid_nzbs[file.zip-movies]
  tests\test_dirscanner.py:56: PytestWarning: The test <Function test_adds_valid_nzbs[file.zip-movies]> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    @set_config({"dirscan_dir": os.path.join(SAB_CACHE_DIR, "watched")})

But if I remove the marking:

  Lib\site-packages\_pytest\python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
  You need to install a suitable plugin for your async framework, for example:
    - anyio
    - pytest-asyncio
    - pytest-tornasync
    - pytest-trio
    - pytest-twisted
    warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))

Even though just a few lines above:

platform win32 -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0
rootdir: C:\Users\x\Downloads\gh\sabnzbd
plugins: flaky-3.7.0, pyfakefs-5.3.2, asyncio-0.23.2, httpbin-2.0.0, httpserver-1.0.8, mock-3.12.0, tavern-2.0.6

I couldn't find much online... Maybe you know what's going on?

@Safihre Safihre added the Bug label Dec 11, 2023
@mnightingale
Copy link
Contributor

It appears pytest-asyncio has changed something in a recently release.

I think the discussion in pytest-dev/pytest-asyncio#706 is relevant and specifically the PR mentioned but I have not looked at it in detail.

Temporarily you could pin pytest-asyncio==0.21.1

@mnightingale
Copy link
Contributor

It looks like it is the @set_config decorator that causes the problem, maybe move that behaviour to setup/teardown or a fixture (a little odd since it would yield None or something).

class TestDirScanner:
    @classmethod
    def setup_class(cls):
        getattr(cfg, "dirscan_dir").set(os.path.join(SAB_CACHE_DIR, "watched"))

    @classmethod
    def teardown_class(cls):
        getattr(cfg, "dirscan_dir").set(getattr(cfg, "dirscan_dir").default)

@Safihre
Copy link
Member Author

Safihre commented Dec 11, 2023

Sounds good, if that fixes it!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants