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

RF+add nose support #29

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Conversation

yarikoptic
Copy link

@yarikoptic yarikoptic commented Oct 17, 2020

Also declare @abc.abstractmethod _run_test for specific
implementations, implemented by pytest plugin
@yarikoptic yarikoptic marked this pull request as draft October 17, 2020 20:48
* origin/nose_proto:
  Nose test runner prototype

 Conflicts:
	pycrunch/plugins/nose_support/nose_runner_engine.py -- took the
       main nose specific body of NoseRunnerEngine, discarded the rest
       which now should be in the parent class logic
@yarikoptic
Copy link
Author

Merged #30 into this PR. Yet to see if works for primary target use case (datalad) probably primarily due to datalad's issue datalad/datalad#5100 . I guess I might need to try it on some simpler project first

@gleb-britecore
Copy link
Collaborator

I did some digging and tried to implement AST discovery. Everything was fine until I had to find a class inheritance tree; AdvancedScenario -> AdvancedTestCase -> AbstractTestCase -> TestCase; AST shows only 1 level of inheritance.

So I started wondering how pytest (and nose) works, and it is a combination of Module import and AST rewrite
image

So, as a surprise for me, they actually run all the code (such as sleep(10)) before the test method execution; and that is not different from SimpleTestDiscovery;

The problem you are facing can be masked with nest-asyncio as described in this answer: https://stackoverflow.com/a/56434301/2377370

import nest_asyncio
nest_asyncio.apply()

pycrunch-engine opens asyncio loop at the startup, so code previously working in synchronous test runner might fail.

I put a 2-liner patch in both engine venv/datalad/lib/python3.7/site-packages/pycrunch/main.py and child runtime multiprocess_child_main.py and was able to run some of the tests from your project:
image

Not sure where to go from here, but I thought it might be interesting, cc @yarikoptic

@yarikoptic
Copy link
Author

yeah, async fiasco we are still fighting: seems to be a big design blow to any python programmer due to alleniating async code from non-async ;-) (nest_asyncio is just a workaround)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Q: no nose(tests) support is planned, correct?
2 participants