Repository: delfick/alt-pytest-asyncio (language: python)

Issue:
Crash when parametrizing a `func` parameter
I wrote a test case with a parametrized `func` parameter:

```python
import pytest


@pytest.mark.parametrize('func', [3])
def test_something(func):
    pass
```

And to my surprise, got a strange error from pytest:

```
FAILED untitled.py::test_something[3] - TypeError: AltPytestAsyncioPlugin.pytest_pyfunc_call.<locals>.run_obj.<locals>.<lambda>() got multiple values for argument 'func'
```

This also happens for async test cases, though the error is slightly different:

```
FAILED untitled.py::test_something[3] - TypeError: converted_async_test() got multiple values for argument 'func'
```




Discussion / hints:

Fix patch:
diff --git a/README.rst b/README.rst
index ecf9a6a..afe3956 100644
--- a/README.rst
+++ b/README.rst
@@ -21,6 +21,10 @@ generator fixtures.
 Changelog
 ---------
 
+0.8.1 - TBD
+    * Remove a namespace conflict that restricted what names could be used as
+      parametrize arguments.
+
 0.8.0 - 1 June 2024
     * Provide simple support for tests being aware of asyncio.Context
     * Remove support for python less than 3.11


Test patch:
diff --git a/alt_pytest_asyncio/async_converters.py b/alt_pytest_asyncio/async_converters.py
index 9e6d883..c49d699 100644
--- a/alt_pytest_asyncio/async_converters.py
+++ b/alt_pytest_asyncio/async_converters.py
@@ -86,7 +86,7 @@ def run_fixture(*args, **kwargs):
     fixturedef.func = run_fixture
 
 
-def converted_async_test(ctx, test_tasks, func, timeout, *args, **kwargs):
+def converted_async_test(ctx, test_tasks, func, timeout, /, *args, **kwargs):
     """Used to replace async tests"""
     __tracebackhide__ = True
 
diff --git a/alt_pytest_asyncio/plugin.py b/alt_pytest_asyncio/plugin.py
index e024db6..bf1ed10 100644
--- a/alt_pytest_asyncio/plugin.py
+++ b/alt_pytest_asyncio/plugin.py
@@ -89,11 +89,11 @@ def pytest_pyfunc_call(self, pyfuncitem):
             def run_obj(*args, **kwargs):
                 try:
                     self.ctx.run(lambda: None)
-                    run = lambda func, *a, **kw: self.ctx.run(func, *a, **kw)
+                    run = lambda func: self.ctx.run(func)
                 except RuntimeError:
-                    run = lambda func, *a, **kw: func(*a, **kw)
+                    run = lambda func: func()
 
-                run(original, *args, **kwargs)
+                run(partial(original, *args, **kwargs))
 
             pyfuncitem.obj = run_obj
 
diff --git a/tests/test_works.py b/tests/test_works.py
index 11b8ff5..985779b 100644
--- a/tests/test_works.py
+++ b/tests/test_works.py
@@ -53,3 +53,13 @@ async def a_list(a_list_fut):
 
     it "uses our fixtures", a_value_times_two:
         assert a_value_times_two == 2
+
+
+@pytest.mark.parametrize("func", [1])
+it "allows func as a parametrize", func:
+    assert func == 1
+
+
+@pytest.mark.parametrize("func", [1])
+async it "allows func as a parametrize for async too", func:
+    assert func == 1