Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tests: useinline_snapshot.Is on parametrized test#945

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ihrpr merged 5 commits intomainfromfix-test-with-snapshot
Jul 14, 2025

Conversation

Kludex
Copy link
Member

@KludexKludex commentedJun 12, 2025
edited
Loading

cc@agronholm

This PR just usesinline_snapshots properly on a parametrized test.

@KludexKludex mentioned this pull requestJun 12, 2025
9 tasks
@agronholm
Copy link

Looks like the tests are still failing though?

@agronholm
Copy link

That one failure looks like just a flaky test.

Kludex reacted with thumbs up emoji

@Kludex
Copy link
MemberAuthor

Kludex commentedJun 12, 2025
edited
Loading

Now the test is fixed... But it's failing correctly... 😅

TheAnyUrl adds a very annoying trailing slash.@Viicos how is that going on the Pydantic side?

@Viicos
Copy link

TheAnyUrl adds a very annoying trailing slash.@Viicos how is that going on the Pydantic side?

In progress inpydantic/pydantic-core#1719, but anyway this will only be included in 2.12.

@agronholm
Copy link

Now the test is fixed... But it's failing correctly... 😅

TheAnyUrl adds a very annoying trailing slash.@Viicos how is that going on the Pydantic side?

If you access the MCP server without the trailing slash, it will redirect you to a URL with the slash added.

@Kludex
Copy link
MemberAuthor

Now the test is fixed... But it's failing correctly... 😅
TheAnyUrl adds a very annoying trailing slash.@Viicos how is that going on the Pydantic side?

If you access the MCP server without the trailing slash, it will redirect you to a URL with the slash added.

Are you saying this is working as expected?

@agronholm
Copy link

Now the test is fixed... But it's failing correctly... 😅
TheAnyUrl adds a very annoying trailing slash.@Viicos how is that going on the Pydantic side?

If you access the MCP server without the trailing slash, it will redirect you to a URL with the slash added.

Are you saying this is working as expected?

I have no idea how the test is supposed to work, TBH. I just observed a lot of redirects happening in the test suite when the forward slash is missing from the end of the URI.

@Kludex
Copy link
MemberAuthor

It's a Starlette thing. There's another PR that fixes the redirect behavior.

agronholm reacted with thumbs up emoji

@KludexKludex requested a review fromihrprJune 13, 2025 08:38
@medaminezghal
Copy link
Contributor

@Kludex Withpytest 8.4.0 I got this problem:

_________________________ ERROR at setup of TestOAuthClientProvider.test_generate_code_verifier __________________________[gw4] linux -- Python 3.13.3 /home/medaminezghal/Documents/AUR_Packages/python-mcp/test/src/mcp-1.9.4/test-env/bin/pythoncls = <class '_pytest.runner.CallInfo'>, func = <function call_and_report.<locals>.<lambda> at 0x7f3b3f42cf40>when = 'setup', reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)    @classmethod    def from_call(        cls,        func: Callable[[], TResult],        when: Literal["collect", "setup", "call", "teardown"],        reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,    ) -> CallInfo[TResult]:        """Call func, wrapping the result in a CallInfo.            :param func:            The function to call. Called without arguments.        :type func: Callable[[], _pytest.runner.TResult]        :param when:            The phase in which the function is called.        :param reraise:            Exception or exceptions that shall propagate if raised by the            function, instead of being wrapped in the CallInfo.        """        excinfo = None        instant = timing.Instant()        try:>           result: TResult | None = func()                                     ^^^^^^/usr/lib/python3.13/site-packages/_pytest/runner.py:344: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.13/site-packages/_pytest/runner.py:246: in <lambda>    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/pluggy/_hooks.py:512: in __call__    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/pluggy/_manager.py:120: in _hookexec    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/_pytest/logging.py:843: in pytest_runtest_setup    yield/usr/lib/python3.13/site-packages/_pytest/capture.py:895: in pytest_runtest_setup    return (yield)            ^^^^^/usr/lib/python3.13/site-packages/_pytest/runner.py:164: in pytest_runtest_setup    item.session._setupstate.setup(item)/usr/lib/python3.13/site-packages/_pytest/runner.py:514: in setup    col.setup()/usr/lib/python3.13/site-packages/_pytest/python.py:1673: in setup    self._request._fillfixtures()/usr/lib/python3.13/site-packages/_pytest/fixtures.py:719: in _fillfixtures    item.funcargs[argname] = self.getfixturevalue(argname)                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/_pytest/fixtures.py:548: in getfixturevalue    fixturedef = self._get_active_fixturedef(argname)                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/_pytest/fixtures.py:639: in _get_active_fixturedef    fixturedef.execute(request=subrequest)/usr/lib/python3.13/site-packages/_pytest/fixtures.py:1127: in execute    result = ihook.pytest_fixture_setup(fixturedef=self, request=request)             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/pluggy/_hooks.py:512: in __call__    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/pluggy/_manager.py:120: in _hookexec    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper    return result.get_result()           ^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper    res = yield          ^^^^^/usr/lib/python3.13/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper    return result.get_result()           ^^^^^^^^^^^^^^^^^^^/usr/lib/python3.13/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper    res = yield          ^^^^^/usr/lib/python3.13/site-packages/_pytest/setuponly.py:36: in pytest_fixture_setup    return (yield)            ^^^^^_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ fixturedef = <FixtureDef argname='oauth_provider' scope='function' baseid='tests/client/test_auth.py'>request = <SubRequest 'oauth_provider' for <Function test_generate_code_verifier>>    def pytest_fixture_setup(        fixturedef: FixtureDef[FixtureValue], request: SubRequest    ) -> FixtureValue:        """Execution of fixture setup."""        kwargs = {}        for argname in fixturedef.argnames:            kwargs[argname] = request.getfixturevalue(argname)            fixturefunc = resolve_fixture_function(fixturedef, request)        my_cache_key = fixturedef.cache_key(request)            if inspect.isasyncgenfunction(fixturefunc) or inspect.iscoroutinefunction(            fixturefunc        ):            auto_str = " with autouse=True" if fixturedef._autouse else ""    >           warnings.warn(                PytestRemovedIn9Warning(                    f"{request.node.name!r} requested an async fixture "                    f"{request.fixturename!r}{auto_str}, with no plugin or hook that "                    "handled it. This is usually an error, as pytest does not natively "                    "support it. "                    "This will turn into an error in pytest 9.\n"                    "See: https://docs.pytest.org/en/stable/deprecations.html#sync-test-depending-on-async-fixture"                ),                # no stacklevel will point at users code, so we just point here                stacklevel=1,            )E           pytest.PytestRemovedIn9Warning: 'test_generate_code_verifier' requested an async fixture 'oauth_provider', with no plugin or hook that handled it. This is usually an error, as pytest does not natively support it. This will turn into an error in pytest 9.E           See: https://docs.pytest.org/en/stable/deprecations.html#sync-test-depending-on-async-fixture/usr/lib/python3.13/site-packages/_pytest/fixtures.py:1181: PytestRemovedIn9Warning

I think it's better to edit it to make it compatible with newerpytest versions.

@dsp-antdsp-ant self-requested a reviewJune 17, 2025 09:47
@agronholm
Copy link

agronholm commentedJun 23, 2025
edited
Loading

@medaminezghal my Trio PR (#946) fixes that too. Right now this PR is the only thing in this code base standing between me and a fully passing test suite.

@agronholmagronholm mentioned this pull requestJun 23, 2025
9 tasks
@agronholm
Copy link

That SSE failure could be due to improperly nested async context managers (typically a stream closed before the task using it has finished)

felixweinberger
felixweinberger previously approved these changesJul 14, 2025
Copy link
Contributor

@felixweinbergerfelixweinberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Approving to unblock#945 - added a proposal making the test anxfail on top of this branch in#1138 if you want to take a look@Kludex?

@Kludex
Copy link
MemberAuthor

Looks good.

felixweinberger reacted with thumbs up emoji

felixweinberger
felixweinberger previously approved these changesJul 14, 2025
@felixweinberger
Copy link
Contributor

took the liberty of rebasing - looks liketest_auth has changed significantly since this PR

@ihrprihrpr merged commit95b44fb intomainJul 14, 2025
13 checks passed
@ihrprihrpr deleted the fix-test-with-snapshot branchJuly 14, 2025 20:59
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ihrprihrprihrpr left review comments

@felixweinbergerfelixweinbergerfelixweinberger approved these changes

@dsp-antdsp-antAwaiting requested review from dsp-ant

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@Kludex@agronholm@Viicos@medaminezghal@felixweinberger@ihrpr

[8]ページ先頭

©2009-2025 Movatter.jp