Closed accoleon closed 9 months ago
Great addition, I will do minimal testing and merge it tomorrow.
Can you actually run async test? I got
if events._get_running_loop() is not None:
> raise RuntimeError(
'Cannot run the event loop while another loop is running')
E RuntimeError: Cannot run the event loop while another loop is running
And need to dig deeper
Side note -> tests are now discovered, and thats excellent
I did - however the actual running of the async tests required nest_asyncio
as described in https://github.com/gleb-sevruk/pycrunch-engine/issues/52#issuecomment-908045411 - I didn't look further into the async system unfortunately. That will come next time!
I got it working via next-asyncio in pycrunch/multiprocess_child_main.py
import nest_asyncio
nest_asyncio.apply()
preparing a fix
Seems up and running now: https://github.com/gleb-sevruk/pycrunch-engine/pull/101
🙌
Thanks a lot; Version 1.6.1 Is published; Let me know about the experience.
You will need to enable plugins in .pycrunch-config.yaml
for this to work
engine:
load-pytest-plugins: true
Yep! Just tested 1.6.1 and works great. Pretty awesome, I loved ncrunch when I was working in .NET and have been looking for something for Python ever since!
Oh Thank You. Just update to back front last updates (1.6.1) and works over python 3.10. Previous versions of python will fail due to syntax updated code not supported.
@vegaroy13 Oh I see what you mean
[98109] 2023-10-17 14:42:45,834 - pycrunch.discovery.ast_discovery - ERROR - parse test_one.py failed with exception: unsupported operand type(s) for |: 'type' and 'type'
Traceback (most recent call last):
File "/Users/gleb/venv/pycrunch_161_39_testing/lib/python3.9/site-packages/pycrunch/discovery/ast_discovery.py", line 68, in find_tests_in_folder
tests_found = self.load_tests_from_ast_representation(ast_tree)
File "/Users/gleb/venv/pycrunch_161_39_testing/lib/python3.9/site-packages/pycrunch/discovery/ast_discovery.py", line 98, in load_tests_from_ast_representation
def process_function_def(func: ast.FunctionDef | ast.AsyncFunctionDef) -> List[str]:
TypeError: unsupported operand type(s) for |: 'type' and 'type'
[98109] 2023-10-17 14:42:45,835 - pycrunch.discovery.ast_discovery - INFO - Time spent parsing AST : 0.0 seconds
I will do another version with typing.Union
to make sure it can still work on 3.9
Version 1.6.2 uploaded to pip; should resolve compatibility issues with Python 3.9
ast.AsyncFunctionDef
to discoveryResolves #62